The Bearer Agent allows you to update the configuration in your code using the following syntax after installing and requiring the @bearer/node-agent
package:
Bearer.init({secretKey: "your_secret_key",stripSensitiveData: true, // default}).then(() => {console.log("Bearer Initialized")})
The Bearer Agent is asynchronous. If initializing at the top level we suggest using theBearer.init({ ... }).then( () => { ... })
approach, however you can use async/await where it is supported.
The following is a list of all available configuration options.
Property | Value |
secretKey | Your Bearer Secret Key (required) |
disabled | When set, the Bearer agent is disabled |
environment | When set, Bearer will associate calls made from the app with this environment. |
stripSensitiveData | Remove sensitive data before sending it to bearer.sh (defaults to |
stripSensitiveKeys | Regular expression used for key name values to strip (see defaults) |
stripSensitiveRegex | Regular expression used for value stripping (see defaults) |
For more on using the stripSensitiveData
, stripSensitiveKeys
, and stripSensitiveRegex
configuration properties see Keep your Data Protected.
Bearer uses your application's environment variable to determine the environments that exist for an application in the Bearer Dashboard. For Node.js, Bearer will use NODE_ENV
to determine the environment name.
Alternately, you can use the environment
key when initializing the Bearer Agent. Setting environment
will take precedence over the NODE_ENV
environment name.
If an environment is not explicitly set, either through NODE_ENV
or with the environment
key, the environment name will default to default
.