Global Configuration - Best Practice

Hi group,

We’re about to start building our 2nd application using ColdBox and as part of this we want to reuse some of the parts from the first.

In terms of configuration settings we’ve got a pile of things like LDAP, datasources, framework configuration that I’d like to abstract out of the first and hold them in some kind of central configuration file.

The ideal situation is that by default each application will load these in but can overwrite them with custom behaviour if need be.

I’ve had a look through the CB docs but I can’t find anything on Best Practice to approach. My original thought was to use an interceptor that could execute beforeConfigurationLoad() and get my central file but all I’m seeing is afterConfigurationLoad().

Does anyone have any good pointers they can share? :slight_smile:

Any help appreciated.


I guess an option is to get each application’s ColdBox.cfc to extend a global Coldbox.cfc.

Each one can call the super.configure() and then overwrite things from that point.

I’m not a big fan of just slapping inheritance in though.

I think on this case inheritance is the way to go. You are creating a family of objects. So in my opinion you looking at alternatives to inheritance before using it was brilliant.

Thanks Luis … think I’m happy with that as well :slight_smile:

I use afterConfigurationLoad() to load up information that is global from the database, and setup all that is needed at that point. I think Aaron has a very good example of this on his blog as well.


Andrew Scott

Thanks Andrew.

If I understand you right afterConflgurationLoad would do the opposite to what I’m thinking.

I want to have a global configuration that can be overwritten by each of the applications with their own specifics if need be.

So things like LDAP settings would generally stay the same but we might want to wide the groups searches in one application wider than that of the defaults.


Sure, if you go down that route then it will work just great. Honestly I never thought of that till Luis mentioned it.


Andrew Scott