module settings + environments

how do you set module-specific settings (or override parent settings)
depending on the environment in the modules config?

What settings are you wanting to override?

implicit ones i declare in the settings struct.

parent apps config:

function development(){
     settings.mySetting = "a";

modules config:

parentSettings = {
      settings.mySetting = "b";


settings.mySetting shows as "b".

if the app is in dev mode, i want to override the modules setting.

Do the same rules apply for coldbox.cfg as it dies for moduleConfig.cfc I am sure it does, as I use detectEnvironment for all my detection of production and development.

Maybe this might help

I am also adding the same convention to modules in 3.5 so it flows. As of now you need to do it manually

that'll work.

thanks, scott!

That would be awesome Luis…

It would be super cool if ColdBox would keep track of which
environment function was matched.

A use case: We have a google analytics viewlet that includes tracking
code. Obviously we dont want that tracking code being included in
development or staging environments, so we have had to add a settings
toggle like Andrew outlines in his blog post.

Would be much easier just to ask ColdBox what enviroment it was
currently running in (just the function name), and if this value was
blank we could assume it did not match a custom environment.

But you can. The value is stored as a setting called "environment"


The value is saved as a setting, so getSetting("Environment") will return the current environment.


Ah cool! I swear I read the docs :slight_smile: