<x-html><div>At 02:54 PM 4/7/2001 +0100, you wrote:</div>
<blockquote type=cite class=cite cite><div>> -----Original
Message-----</div>
<div>> From: BORKMAN Lee
[<a href="mailto:[EMAIL PROTECTED]"
EUDORA=AUTOURL>mailto:[EMAIL PROTECTED]</a>]</div>
<div>> </div>
<div><snip></div>
<div>> Basically I don't like the idea of </div>
<div>> tampering with</div>
<div>> a monolithic app_globals or myGlobals, when all I want to do
</div>
<div>> is tell the app</div>
<div>> that THIS server's document root is xxx instead of yyy.</div>
<div><snip></div>
<br>
<br>
<div>I've written a custom tag called whatserveristhis.cfm, which is
customised</div>
<div>for each server, that sets request.thisserver to the name of the
machine</div>
<div>eg on the dev box it says:</div>
<div><cfset request.thisserver = "dev"></div>
<br>
<div>Then, in the file that sets server specific variables:</div>
<br>
<div><cf_whatserveristhis></div>
<br>
<div><CFSWITCH EXPRESSION="#request.thisserver#"></div>
<div> <CFCASE VALUE="live"></div>
<div> <CFSET
request.server.webroot =
"e:\www\myapp\"></div>
<div> </CFCASE></div>
<div> <CFCASE VALUE="test"></div>
<div> <CFSET
request.server.webroot = "d:\cf\myapp\"></div>
<div> </CFCASE></div>
<div> <CFCASE VALUE="dev"></div>
<div> <CFSET
request.server.webroot =
"f:\www\myapp\cf\hr"></div>
<div> </CFCASE></div>
<div> <CFCASE VALUE="other"></div>
<div> <!--- do nought - the
vars should be set in whatserveristhis.cfm on</div>
<div>any 'other' servers ---></div>
<div> </CFCASE></div>
<div> <CFDEFAULTCASE></div>
<div>
<blink><h1>warning warning - server not
configured</h1></blink></div>
<div> <CFABORT></div>
<div> </CFDEFAULTCASE></div>
<div></CFSWITCH></div>
<br>
<div>I added the <CFCASE VALUE="other"> to enable the
code to run an any machine,</div>
<div>and in this case i leave it up to the local whatserveristhis.cfm to
set all</div>
<div>the variables necessary for the app.</div>
<div>With hindsight it might be worth sending the name of the app as an
attribute</div>
<div>of cf_whatserveristhis, but as most projects are confined to the 3
main</div>
<div>servers its not a maasive issue.</div>
<div>This has made it a doddle to move code between boxes without having
to mess</div>
<div>about changing stuff, and if you're worried about the
performance</div>
<div>implications of the custom tag call and cfswitch then you can always
edit</div>
<div>the file once its gone live...</div>
<br>
<div>Bert</div>
<br>
<div>ps I put whatserveristhis.cfm is in its seperate
/customtags/serverspecific/</div>
<div>directory to minmise the risk of it being moved between
servers</div>
<div>accidentally.</div>
<br>
<div>pps and it _should_ be called WHICHserveristhis.cfm, but its too
late now</div>
<br>
<div>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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