Environment variables

Use environment variables for application-specific configuration values (like configuring server environment, application names or agent logging). You can also use environment variables to set any other valid properties for the Node.js agent.

You can see a full list of valid properties in the Node.js YAML template, but here are some common examples as environment variables:

Environment variable

Description

CONTRAST__API__SERVICE_KEY

Set the service key needed to communicate with Contrast.

CONTRAST__API__API_KEY

Set the API key needed to communicate with Contrast.

CONTRAST__API__USER_NAME

Set the user name needed to communicate with Contrast.

CONTRAST__API__URL

Set the URL for the Contrast web interface.

CONTRAST__APPLICATION__NAME

Override the reported application name.

CONTRAST_CONFIG_PATH

When set, supersedes the default location of the YAML configuration file. (Unlike other environment variables, this one cannot be set as a YAML property, and contains only single underscores.)

CONTRAST__SERVER__PATH

Override the reported server path.

CONTRAST__AGENT__LOGGER__APPEND

When set to false, creates a new log file on startup instead of appending and rolling daily. Default is true.

CONTRAST__AGENT__LOGGER__LEVEL

Logging level: FATAL, ERROR, WARN, INFO, DEBUG or TRACE. Default is ERROR.

CONTRAST__AGENT__LOGGER__PATH

Where Contrast will put its debug log. Default is node-contrast.log.

CONTRAST__AGENT__LOGGER__STDOUT

When set to false, suppresses output to stdout. Default is true.

Note

For the Node.js agent you must manually configure DEBUG. INFO-level statements aren't logged to the console unless the environment variable DEBUG is set to include the Contrast namespace: DEBUG=contrast:*. This could be useful in environments where you don't have access to the file system (like Docker or ECS).

If you want to redirect logging for the Node.js, see more examples on the npm site or contact Support for assistance.