> -----Original Message----- > From: BORKMAN Lee [mailto:[EMAIL PROTECTED]] > <snip> > Basically I don't like the idea of > tampering with > a monolithic app_globals or myGlobals, when all I want to do > is tell the app > that THIS server's document root is xxx instead of yyy. <snip> I've written a custom tag called whatserveristhis.cfm, which is customised for each server, that sets request.thisserver to the name of the machine eg on the dev box it says: <cfset request.thisserver = "dev"> Then, in the file that sets server specific variables: <cf_whatserveristhis> <CFSWITCH EXPRESSION="#request.thisserver#"> <CFCASE VALUE="live"> <CFSET request.server.webroot = "e:\www\myapp\"> </CFCASE> <CFCASE VALUE="test"> <CFSET request.server.webroot = "d:\cf\myapp\"> </CFCASE> <CFCASE VALUE="dev"> <CFSET request.server.webroot = "f:\www\myapp\cf\hr"> </CFCASE> <CFCASE VALUE="other"> <!--- do nought - the vars should be set in whatserveristhis.cfm on any 'other' servers ---> </CFCASE> <CFDEFAULTCASE> <blink><h1>warning warning - server not configured</h1></blink> <CFABORT> </CFDEFAULTCASE> </CFSWITCH> I added the <CFCASE VALUE="other"> to enable the code to run an any machine, and in this case i leave it up to the local whatserveristhis.cfm to set all the variables necessary for the app. With hindsight it might be worth sending the name of the app as an attribute of cf_whatserveristhis, but as most projects are confined to the 3 main servers its not a maasive issue. This has made it a doddle to move code between boxes without having to mess about changing stuff, and if you're worried about the performance implications of the custom tag call and cfswitch then you can always edit the file once its gone live... Bert ps I put whatserveristhis.cfm is in its seperate /customtags/serverspecific/ directory to minmise the risk of it being moved between servers accidentally. pps and it _should_ be called WHICHserveristhis.cfm, but its too late now ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
