Hey everyone, I’ve got some exciting new stuff on the bleeding edge of CommandBox. Now we have global config settings. They are stored in ~/.CommandBox/CommandBox.json
These can be used by CommandBox to store system-wide settings or user preferences that controls how CommandBox runs. The other use is that now you can directly override module settings via namespaced config settings that follow a convention.
https://ortussolutions.atlassian.net/browse/COMMANDBOX-291
https://ortussolutions.atlassian.net/browse/COMMANDBOX-313
There are three new commands for interacting with config settings:
- config show
- config set
- config clear
These work in almost every way like the package show/set/clear commands. (I refactored the logic for re-use).
config set mySetting foo=bar
config show mySetting
config clear mySetting
For module developers (custom commands, interceptors, etc), the config is programmatically available via the new ConfigService. See the CFC source for the simple getSetting() setSetting() API.
The coolest part is if you have a module called “foo” with a setting in its ModuleConfig settings struct called bar, you can override that setting (without touching the 3rd party module code) like so:
config set modules.foo.bar = value
I put together a sample module last night that shows this in action:
https://github.com/bdw429s/commandbox-banner-customizer
The entire module is just a single file-- ModuleConfig which has 3 default settings and an OnCLIStart() interceptor listener. It lets you control the ASCII art banner that shows when CommandBox opens via your config settings. It’s just an example, but should show what’s possible. Read the readme (and the one file of code) to see how it works.
I’ll be documenting all the new CommandBox interception points, but they’re also here on this ticket:
https://ortussolutions.atlassian.net/browse/COMMANDBOX-252
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com