detectEnvironment()
functioncommandbox
please read ALL options belowenvironments
in your coldbox configuration with the named environments and their associated regular expressions for its cgi
host names to match for you automatically. If the framework matches the regex with the associated cgi.http_host
, it will set a setting called Environment
in your configuration settings and look for that environment setting name in your CFC as a method by convention. That's right, it will check if your CFC has a method with the same name as the environment and if it exists, it will call it for you. Here is where you basically override, remove, or add any settings according to your environment.Warning : The environment detection occurs AFTER theconfigure()
method is called. Therefore, whatever settings or configurations you have on theconfigure()
method will be stored first, treat those as Production settings.
staging
, development
, testing
etcetera, depending on the required environment. As in the regex example, a function named after your environment (e.g. staging()
or development()
) will be called after your configure
method.cgi.http_host
variable. You will NOT fill out an environments structure but actually create a method with the following signature: