Dynamic Configuration Settings

I’m wondering if someone can give me an example of this or point me to some specific documentation. I want to be able to change certain (read ANY) coldbox and custom settings based on the environment. Since I can easily detect which environment I’m in (read development, production), how can I, for example, add an interceptor into the mix based on that environment, or change from one data source to another (say I have one called master but on dev it points to one db and in production it points to a differently named db).

I’ve been playing around with this for a little bit and what I cannot seem to get my head around is (a) how to change framework settings like these on the fly and (b) how they would be registered since the environment functions kick off after configuration completes. I THINK it does not entirely matter typically, at least for db, because the structure is exposed through wirebox which provides dynamic getter functions for name, etc…so I should be able to do

datasources.customdatasource = {}

or

datasources.master = {}

to replace the existing one based on environment…but I’m not sure that will work, or whether or not things like interceptors being added on the fly in this way will either.

Examples / Advice ?

MIke

Sorry, forgot about the code in the subject…coldbox 3.0.x but I’m using 3.5.x

oh…set while

settings.mynewsetting = “hello”;

works

setSetting(“mynewsetting”, “hello”);

does not…is that because the setSetting function is not yet available right after configuration loads?

Mike

oooh…or wait a second…is it that all the settings are loaded but nothing done with any of them until after the environment functions run?

I think I’m confusing myself more than I need to.

Mike