Personally what I do is the following;
 
I structure my directories like the following
d:\inetpub\wwwroot\internet\development\{app name}
 
Then in the application.cfm I do
 
<cfset request.pathRoot = getDirectoryFromPath(getCurrentTemplatePath())>
<!--- check what phase the application is in --->
<cfset position = reFindNoCase("(development|testing|staging|production)", cgi.path_translated, 1, "true")>
<cftry>
 <cfset request.applicationPhase = mid(cgi.path_translated, position.pos[1], position.len[1])>
 <cfcatch>
  <h1>Application mode could not be found!</h1>
  <strong>You need to set this manually</strong>
 </cfcatch>
</cftry>
 
This will get me the path and tell me what application settings to use.
request.applicationPhase will determine what to use, for example for the DSN etc. I do
 
if ( NOT isDefined("application.setting") )
{
 setting = structNew();
 structInsert(variables.setting, "applicationName", request.applicationName);
 structInsert(variables.setting, "dsnMain", "dsn#variables.setting["applicationName"]#_#request.applicationPhase#");
 structInsert(variables.setting, "imageRoot", "image/");
 structInsert(variables.setting, "mapping", "/#variables.setting["applicationName"]#_#request.applicationPhase#/");
 structInsert(variables.setting, "dateFormat", "dddd, dd mmm yyyy");
 structInsert(variables.setting, "timeFormat", "H:mm");
 application.setting = duplicate(variables.setting);
}
 
Then I also read an XML file into the application scope which will contain several variables specific to each phase, example;
 
<cffile action="" file="#request.pathRoot#\variable_#request.applicationPhase#.xml" variable="xmlVariable">
 
In short I never ever have to change anything upon moving the application from development to testing etc.
Does that help?
 
PS. I have a doco that sort of describes some of these things... Not that anyone is interested ;-))
 
-----Original Message-----
From: Barry Beattie [mailto:[EMAIL PROTECTED]
Sent: Monday, 24 May 2004 3:49 PM
To: CFAussie Mailing List
Subject: [cfaussie] looking for ideas - storing config settings

Hi all

 

Any advice on where is a good place to store config settings for multiple apps? Our many clients have variaing configurations. It would be one file for all app settings.

 

we’re probably going to end up using the registry for DSN passwords, etc, but how about other things – paths, names, defaults, etc? Some of these will have to be calculated and written at first run, or in some cases, prompt the user for any missing values and then write them. I suppose it’d be like a simple installer program.

 

Application vars would only be available per app, not across all of them. Server vars seem interesting but they’d have to persist on re-boot and I’m not sure how they’d work on clustering.

 

Chances are XML files are the best way to store it but where should they go?

 - In the webroot?not all installs have a “webroot” as such, some have CF mapped directories.

 - Inside C:\CFusionMX somewhere? could we trust that path would always exist? Hmmm…

 

at least these are all windows machines.

 

any suggestions?

 

thanx

barry.b

 

 

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
Register now for the 3rd National Conference on Tourism Futures, being held in Townsville, North Queensland 4-6 August - www.tq.com.au/tfconf

Reply via email to