Configuration

Configure the Bearer Agent

The Bearer Agent allows you to update the configuration in your code using the following syntax after installing and requiring the bearer-agent gem:

Bearer.init_config do |config|
config.secret_key = "YOUR_BEARER_SECRET_KEY" # Required, string: Your Bearer private key
config.disabled = false # Optional, boolean: enable/disable Bearer globally
end

Available Configuration Options

The following is a list of all available configuration options.

Property

Value

config.secret_key

Your Bearer Secret Key (required)

config.disabled

When set, the Bearer agent is disabled

config.environment

Sets the name of the environment to be used in the dashboard.

config.strip_sensitive_data

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

config.strip_sensitive_keys

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

config.strip_sensitive_regex

Regular expression used for value stripping (see defaults)

For more on using the strip_sensitive_data, strip_sensitive_keys, and strip_sensitive_regex 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. For Ruby, Bearer will look for any of the following environment variables to determine the name:

  • RUBY_ENV

  • RAILS_ENV

  • RACK_ENV

  • APP_ENV

If the config.environment is set in your agent configuration, it will override any of the above ENV names.