Runtime Configuration
Configure it your way!
BoxLang has an installation-level configuration file that allows developers to adjust various settings from the compiler to default cache providers, runtime-wide data sources, and much more. Depending on which runtime you are using, the configuration file location might change, but the configuration segments remain the same.
AWS Lamba
{lambdaRoot}/boxlang.json
Operating System
~/.boxlang/config/boxlang.json
MiniServer
~/.boxlang/config/boxlang.json
CommandBox
~/.commandbox/servers/{serverHome}/WEB-INF/boxlang/config/boxlang.json
All runtimes allow for configuration overrides.
boxlang.json
Once you startup a runtime, the runtime will find the BOXLANG_HOME
and create the config/boxlang.json
file with the defaults that it ships with. You may also change the granular config settings at runtime using the environment or Java properties by prefixing any configuration item with BOXLANG_
or boxlang.
See below.
If you are running BoxLang within CommandBox, the configuration file will be inside the server directory inside of CommandBox under WEB-INF/boxlang/
. You can also run the following command to see the server home directory:
Runtime Home Directory
By default, the BoxLang home directory is a .boxlang/
directory inside your user's home directory. For instance, on a Ubuntu machine, this might be /home/elpete/.boxlang/
if you are executing BoxLang under the elpete
user account.
ℹ️ The BoxLang home can be adjusted on startup via a --home
flag:
By allowing a custom home directory, you can manage multiple BoxLang runtimes and allow:
custom, per-runtime configuration
a custom set of BoxLang modules
etc
Boxlang.json Reference
Here is the latest reference of the current default boxlang.json
file:
https://github.com/ortus-boxlang/BoxLang/blob/development/src/main/resources/config/boxlang.json
Please note that JSON support in BoxLang allows you to use comments inline.
Internal Variables
The following are the internal variable substitutions you can use in any value:
Here is an example:
Environmental/Properties Configuration
BoxLang gives you the ability to override any of the runtime configuration or module settings via environment variables or Java system properties. For example adding an environment variable of boxlang.security.allowedFileOperationExtensions=.exe,.sh
would override the disallowed defaults, and allow users to upload and rename files with these extensions ( not a good idea! ).
The variable names can be either snake-cased or dot-delimited. For example BOXLANG_DEBUGMODE=true
will work the same as boxlang.debugMode=true
to set the entire runtime in to debug mode.
This convention allows you to make granular changes to sub-segments of the configuration without overriding parent items. JSON is also allowed when overriding config settings. For example, if I wanted to set the runtime logging level to trace without putting the runtime in to DebugMode, I could set the environment variable: boxlang.logging.loggers.runtime.level=TRACE
or add the JVM arg -Dboxlang.logging.loggers.runtime.level=TRACE
Environment Variable Substitution
BoxLang supports environment variable substitution using the syntax ${env.environment_variable_name:default}
. For example, using ${env.MYSQL_HOST:localhost}
will result in the value of the MYSQL_HOST
environment variable, if found, or fall back to the localhost
value if the environment variable is not defined.
Inside your boxlang.json
configuration file, you can use this to populate datasource credential secrets:
Configuration Segments
Here, you will find each segment and its configuration details.
Last updated
Was this helpful?