-
|
I want to set some variables that differ for development environment vs production environment. I notice in the settings.cfm in /config, values for an environment use the set() function, but that just sets values into CFWheels configurations. I'm looking for a place to set global variables that are dependent on the environment I'm running in. I'd also like to know where to set global variables that don't have anything to do with the environment, like a lookup struct of values that don't change and I want them defined and accessible everywhere. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
|
@cfcoder Bruce you can set those in the various config files. You can put any code you want in those files in addition to framework settings. For instance put all common globals in the |
Beta Was this translation helpful? Give feedback.
-
It's not the job of a controller to be doing stuff like this. A controller should simply be marshalling incoming request values, calling the model layer to do [whatever data processing is needed for the given request], and ensuring the view gets the data it needs. This sort of thing is the job of something in the model tier. Stuff relating to sessions should be set in In |
Beta Was this translation helpful? Give feedback.
The
config()definition is cached, so if you setrequest.foo = 1withinconfig()directly, it will only be run once, when the controller is initialised (so only a?reload=true/ application restart will re-examine it).What you can do is use a filter to setup things, which, whilst the config() function is cached, will get run.
i.e,