[Tip of the Week] Complex ColdBox Settings

One of the handy things about the ColdBox settings CFC is you can store ad-hoc settings for your application which can be retrieved or injected anywhere in your application.

Remember, since your settings config is just a struct in a CFC, you aren’t limited to settings which are strings. You can store pretty much any kind of setting that will fit into a ColdFusion variable.

// Custom Settings
settings = {
useSkins = true,
servers = [‘web1’,‘web2’,‘web3’,‘web4’],
skinsPath = “views/skins”,
myUtil = createObject(“component”,"#appmapping#.model.util.MyUtility")
};

// Add another late addition here
settings[“setMe”] = {as = ‘you wish’};

More info here: http://wiki.coldbox.org/wiki/ConfigurationCFC.cfm#settings

P.S. Don’t forget, in your environment overrides you don’t need to specify the entire settings struct again. You can override individual settings by referencing them directly.

function stage() {
settings.servers = [‘stage1’,‘stage2’];
}

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com