Env Var Overrides
Every Config Setting can be overridden by convention by creating environment variables in the shell where you run
box. This is ideal for Docker containers or CI builds where you want to easily set one-off settings and not require an entire JSON file. You can set these as actual environment variables or Java system properties of the CLI. Env vars are loaded AFTER any
.cfconfig.jsonfiles have been loaded by convention and will override any settings in the JSON. They are not case-sensitive.
The var must start with the text
cfconfig_and will be followed by the name of the setting.
For nested settings inside of a struct or array you can use underscores to represent dots. Note the following will error if there is not already a datasource named
myDSNin the server.
The overrides are applied using the same mechanism that the
cfconfig setcommand uses, which means you can also pass JSON directly for complex values.
# JSON which will be parsed
On OS's like Windows which allow for any manner of special characters, you can provide any string which would also be valid for the
config setcommand. Ex:
# dot-delimited keys
# array indexes too
When you provide JSON, the
appendflag will be set to true when adding the configuration to what's already in CommandBox.
Overridden env vars will not be written to any
.cfconfig.jsonfile and will be lost when box stops. They will also take precedence and override any explicit settings already set.
If you want to specify a setting via an env var that targets a web context, you can use the following conventions:
# Default (server context)
# Force web context. (On adobe, just loaded normally)
# Force server context- same as default. (On adobe, just loaded normally)