Modules & Module Settings
The modules and moduleSettings configuration directives — module behavior and per-module settings.
Modules & Module Settings
The modules structure is used to configure the behavior of ColdBox Modules.
modules = {
// An array of modules to load ONLY
include = [],
// An array of modules to EXCLUDE for operation
exclude = [ "paidModule1", "paidModule2" ]
};ModuleSettings
Option 1: Coldbox Config
This structure within config/Coldbox.bx (or .cfc for CFML) is used to house module configurations. Please refer to each module's documentation on how to create the configuration structures. Usually the keys will match the name of the module to be configured.
class {
function configure() {
moduleSettings = {
myModule = {
someSetting = "overridden"
}
};
}
}component {
function configure() {
moduleSettings = {
myModule = {
someSetting = "overridden"
}
};
}
}Option 2: Config Object Override
Starting in ColdBox 7, you can store module configurations as their own configuration file within the application’s config folder outside of the config/Coldbox.bx (or .cfc for CFML). The naming convention is config/modules/{moduleName}.bx (or .cfc for CFML)
The configuration class will have one configure() method that is expected to return a struct of configuration settings as you did before in the moduleSettings
The following example overrides the original module configuration entirely:
For large module configs where only a few keys need to be changed, you can update the config by modifying the struct passed in as an argument and then returning the updated version.
Injections
Just like a ModuleConfig this configuration override also gets many injections:
controller
coldboxVersion
appMapping
moduleMapping
modulePath
logBox
log
wirebox
binder
cachebox
getJavaSystem
getSystemSetting
getSystemProperty
getEnv
appRouter
router
Env Support
This module configuration object will also inherit the ModuleConfig.bx (or .cfc for CFML) behavior that if you create methods with the same name as the environment you are on, it will execute it for you as well.
Then you can change the original struct as you see fit for that environment.
Last updated
Was this helpful?