RE: RE: [coldbox:10525] Detecting the environment through a set flag rather than domain

> It was more the case that if ColdBox doesn’t match a domain it automatically loads in production

Actually, this behavior is up to you. I prefer to make my default ColdBox settings the production ones, and use the environment detection to switch over to local, dev, or stage. However, there’s nothing keeping you from reversing that by switching where you put your production settings.

Start by putting whatever collection of settings you deem “safest” in the default configure() method of coldbox.cfc. This way, if no other environment is matched, these settings will be used.
Next setup whichever process you want to use for sniffing out your production servers (host name, machine name, mac address, whatever) and put your PRODUCTION settings in a “production” method that ONLY gets called when you say. That way, dev settings are the default, and production settings are the exception. So when “Prod75” and “Prod438” get set up, they won’t use production settings until you explicity go and add them into the config as valid “production” servers.

Make sense?


It does Brad, thanks for your time :-). It was actually one approach we were discussing when we started planning all this out.

The main issue is the emails more than anything else. We can’t have any emails going to students if its not production. Last thing they want is a dumby email telling them they owe us thousands of pounds!!

At the same time we want Development to be sent to the specific Developer and Test to go out to a test group.

So really it gets a bit complicated to define a “default” environment with such a small but important part.

Reversing the process at this stage would also mean recoding and testing beyond the configuration. Something we don’t really have time for :frowning:

The easiest I think would be the ANT stamping one. I’ve definately learnt from this though and its something I’ll keep in mind for future projects with CB.

Thanks again,

No it doesn’t get complicated at all…


Andrew Scott