Skip to main content

Configure an agent with generic HTTP tools for use in recipes

You have internal services within your enterprise that you may want to use within your recipes. Some possible examples follow:

  • Launch Darkly - I want to use a recipe to identify code paths that can no longer be hit due to a Launch Darkly flag that has been turned on for a long time.
  • Security advisory database - I have a security advisory database internally, and I want to use a recipe to identify when my dependencies match a security advisory in my internal database.
  • NPM Registries - I want to run a recipe that performs npm install commands that need to install dependencies from a private registry.

Setting up a generic HTTP tool will allow you to use org.openrewrite.ipc.http.HttpSender from your internal recipes to call tools inside your environment. Example usage of HttpSender. It also enables the use of org.openrewrite.nodejs.NpmExecutor in NodeJS recipes allowing the platform to proxy HTTP requests made during npm installs to the registry within your environment. Example usage of NpmExecutor.

Agent configuration

The following table contains all the variables/arguments you need to add to your Moderne agent run command to work with your HTTP tool. Please note that these variables/arguments must be combined with ones found in other steps in the Configuring the Moderne agent guide.

You can configure multiple generic HTTP tools by including multiple entries, each with a different {index}.

Variables:

Variable NameRequiredDefaultDescription
MODERNE_AGENT_HTTPTOOL_{index}_URLtrueFully qualified URL to your HTTP tool.
MODERNE_AGENT_HTTPTOOL_{index}_USERNAMEfalseUsername used to authenticate to HTTP tool.

Note: Only one of basic auth (username+password) and bearer token can be used. If username and password are specified, bearerToken must not be provided.
MODERNE_AGENT_HTTPTOOL_{index}_PASSWORDfalsePassword used to authenticate to HTTP tool.

Note: Only one of basic auth (username+password) and bearer token can be used. If username and password are specified, bearerToken must not be provided.
MODERNE_AGENT_HTTPTOOL_{index}_BEARERTOKENfalseBearer token used to authenticate to HTTP tool.

Note: Only one of basic auth (username+password) and bearer token can be used. If bearerToken is specified, username and password must not be provided.
MODERNE_AGENT_HTTPTOOL_{index}_SKIPSSLfalsefalseSpecifies whether or not to skip SSL validation for HTTP connections to this HTTP tool. This must be set to true if you use a self-signed SSL/TLS certificate.
MODERNE_AGENT_HTTPTOOL_{index}_SKIPVALIDATECONNECTIVITYfalsefalseBy default, on agent startup, we will validate that we can connect to this HTTP tool, and fail to start up the agent if we cannot. Set this to true to skip this validation.

Example:

docker run \
# ... Existing variables
-e MODERNE_AGENT_HTTPTOOL_0_URL=https://launchdarkly.mycompany.com \
-e MODERNE_AGENT_HTTPTOOL_0_USERNAME=myUser \
-e MODERNE_AGENT_HTTPTOOL_0_PASSWORD=${SECRET_NAME} \
# ... Additional variables