AppSignal for Node.js load order

AppSignal for Node.js can be configured in a couple of different ways - through the Appsignal constructor or environment variables.

The configuration is loaded in a four-step process, starting with the package defaults and ending with reading environment variables. The configuration options can be mixed without losing configuration from a different option.

Load orders

1. Module defaults

The AppSignal module starts with loading its default configuration, setting paths and enabling certain features.

The agent defaults can be found in the module source.

2. System detected settings

The gem detects what kind of system it's running on and configures itself accordingly.

For example, when it's running inside a container-based system (such as Docker and Heroku) it sets the configuration option runningInContainer to true.

3. Environment variables

AppSignal will look for its configuration in environment variables. When found these will override all given configuration options from previous steps.

export APPSIGNAL_APP_NAME="my custom app name"
# start your app here

4. Initial configuration given to Appsignal constructor

When initializing the Appsignal object, you can pass in the initial configuration you want to apply. This is an object of any of the options described below.

const appsignal = new Appsignal({
  active: true,
  name: "<YOUR APPLICATION NAME>",
  pushApiKey: "<YOUR API KEY>", // Note: renamed from `apiKey` in version 2.2.5
});

This step will override all given options from the defaults or system detected configuration.

Want to help us improve this documentation page?

Create a pull request

Need more help?

Contact us and speak directly with the engineers working on AppSignal. They will help you get set up, tweak your code and make sure you get the most out of using AppSignal.

Contact us

Start a trial - 30 days free

AppSignal is a great way to monitor your Ruby, Elixir & Node.js applications. Works great with Rails, Phoenix, Express and other frameworks, with support for background jobs too. Let's improve your apps together.

Start a trial