This is the official documentation of the agent_ruby Ruby agent.
The settings can be integrated into the Rails configuration mechanism. The configuration is done in the config/initializers/forest_admin.rb file.
ForestAdminRails.configuredo|config| # Mandatory options (those will be provided during onboarding) config.auth_secret='YOUR_AUTH_SECRET' config.env_secret='YOUR_ENV_SECRET' config.is_production=false # Optional variables config.customize_error_message=... config.logger=... config.logger_level=... config.permissions_cache_duration_in_seconds=... config.prefix=... config.schema_path=...end
Mandatory variables
All mandatory variables are provided as environment variables during onboarding.
Your agent cannot be started without them, and no default values are provided.
auth_secret (string, no default)
This variable contains a random secret token which is used to sign authentication tokens used in request between your users and your agent.
It is generated during onboarding, but never leaves your browser, and is not saved on our side.
Never share it to anybody, as that would allow attackers to impersonate your users on your agent!
env_secret (string, no default)
This variable contains a random secret token which is used to authenticate requests between your agent and our servers.
Unlike the auth_secret, it is stored in our database, so it can be privately shared with Forest Admin employees.
Never share it publicly, as it would allow attackers to impersonate your agent with our servers. That would not cause any data leak, but opens the possibility for attackers to cause denial of service.
is_production (boolean, no default)
In development mode the agent has a few extra behaviors (when using )is_production = false)
At startup, the agent will print the URL of all mounted charts
At startup, the agent will update the .forestadmin-schema.json.
When exceptions are thrown, a report will be printed to stdout.
Optional variables
customize_error_message (function, defaults to nil)
When unexpected errors are raised in the agent code during a request, the error will be logged (using options.logger), but in the admin-panel, the final user will get a default message 'Unexpected error'.
This is done as to:
Prevent error message from leaking internal information about the agent (credentials, ...).
Prevent technical/cryptic error messages to show in the frontend.
This behavior can be customized.
forest_server_url (string, defaults to 'https://api.forestadmin.com')
Those permissions are enforced both in the frontend, and in your agent.
This configuration variable allows to customize how often the agent should ask the server to provide the permissions table.
prefix (string, default to empty string)
This variable adds a prefix to the url at which routes are locally mounted on your application. It is mostly used for customers which wish to mount multiple agent instances on the same Node.js process (for setups using multiple Forest Admin projects).
Note that this variable has no influence on the base URL that will be used by your users to reach the agent: it is determined only by the application URL provided during onboarding and deployment.
Application URL during onboarding
This is done so that customers using reverse proxies can implement their routing table as they see fit.