setting environment / system wide variables

2 views
Skip to first unread message

Mike Henke

unread,
Dec 30, 2009, 3:30:32 PM12/30/09
to ColdFusion on Wheels
Awhile ago someone had the great idea of setting specific environment
variables using something in the settings.cfm file for the environment
like:

<cfset loc.myapp = {}>
<cfset loc.myapp.base = "http://www.server.com">
<cfset loc.myapp.filepath = "C:\JRun4\servers\dev\cfusion.ear
\cfusion.war\serversite\">
<cfset loc.myapp.homepagetitle = "My home page">
<cfset set(myapp = loc.myapp)>

I was looking over my code and see homepage really doesn't belong in
the environment/settings.cfm but in the config/settings.cfm

in config/enviromentName/settings.cfm can i do a

<cfparam name="loc.myapp" default = {}> and delete the cfset for
homepagetitle .

and then in environment/settings.cfm

<cfparam name="loc.myapp" default = {}>
<cfset loc.myapp.homepagetitle = "My home page">
<cfset set(myapp = loc.myapp)>

Or should i use config/app.cfm somehow....

raulriera

unread,
Dec 30, 2009, 5:07:19 PM12/30/09
to ColdFusion on Wheels
Yes you can, remember that the setting will be available only on that
environment though

Mike Henke

unread,
Dec 31, 2009, 9:43:24 AM12/31/09
to ColdFusion on Wheels
I was going to set the variable that is the same for all environments
in config/settings.cfm so if will be available in all environments.
Byt thinking about it more, I wonder if it should go in app.cfm

Per Djurner

unread,
Dec 31, 2009, 9:46:32 AM12/31/09
to cfwh...@googlegroups.com
The app.cfm file is only for setting "this" variables.
this.scriptProtect and all those.

> --
>
> You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
> To post to this group, send email to cfwh...@googlegroups.com.
> To unsubscribe from this group, send email to cfwheels+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cfwheels?hl=en.
>
>
>

Mike Henke

unread,
Dec 31, 2009, 9:53:40 AM12/31/09
to ColdFusion on Wheels
Thanks, I'll need to study that more.

Mike Henke

unread,
Dec 31, 2009, 10:12:34 AM12/31/09
to ColdFusion on Wheels
My final cleaner solution was:

config/settings.cfm
<!--- all environment application variables --->
<cfset loc.myapp = {}>
<cfset loc.myapp.homepagetitle = "My Page Title">
<cfset set(myapp = loc.myapp)>

config/production/settings.cfm (and other environment_folder/
settings.cfm)
<!--- specific environment application variables --->
<cfset loc.myapp = get("myapp") >
<cfset loc.myapp.base = "http://production.com/folder/">


<cfset loc.myapp.filepath = "C:\JRun4\servers\dev\cfusion.ear

\cfusion.war\production\">
<cfset set(myapp = loc.myapp)>

Reply all
Reply to author
Forward
0 new messages