Configuration

Configure the Bearer Agent

The Bearer Agent supports additional configuration options during initialization. For example:

\Bearer\Agent::init([
"secretKey" => "YOUR_BEARER_SECRET_KEY",
"stripSensitiveData" => true,
"stripSensitiveKeys" => "/^authorization$|^client.id$|^access.token$|^client.secret$/i",
"stripSensitiveRegex" => "[a-z0-9]{1}[a-z0-9.!#$%&’*+=?^_`{|}~-]+@[a-z0-9-]+(?:\\.[a-z0-9-]+)*"
]);

Available Configuration Options

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

Sets the name of the environment to be used in the dashboard. (defaults to development)

stripSensitiveData

Remove sensitive data before sending it to bearer.sh (defaults to true)

stripSensitiveKeys

Regular expression string used for key name values to strip (see defaults)

stripSensitiveRegex

Regular expression string used for value stripping (see defaults)

For more on using the stripSensitiveData, stripSensitiveKeys, and stripSensitiveRegex configuration properties see Keep your Data Protected.

Setting an application's environment name

Bearer uses your application's environment variable or the configuration to determine the environments that exist for an application in the Bearer Dashboard. The agent will infer the environment name from the env or APP_ENV environment variables if they exist.

You can also set the environment name by using the environment argument when configuring the agent during initialization. If environment is set, it will override any name detected by your application's environment variables.

If no environment name can be detected, the environment will default to "development".