Copy link to clipboard
Copied
Hi,
I am looking for input on how some of you may handle this situation. I have a production and a development server for the obvious reasons. But what I would like to do is have a dynamic way for the application to tell what server it is on. For instance, during development/testing there will be "fake" cases built that only the test group needs to be aware of and as an example the system will email the "fake" results to my test team so that they can see what is happening on the test side. But, once I implement and move everything to production the test rules no longer apply. As it is now, I manually make the switches in code manually between test and production scenarios. What I would like acheive is the application to just "know" what to do based on the server it is running from. I know I could write some code to look at the URL to distinguish the difference, but I dont like that idea. I would like a solution that would perform more at the system level. Any ideas?
application.cfc or cfm will give you the most bang for your buck. Don't make it a local varible though. Put it in the application or session scope
Copy link to clipboard
Copied
You'll have to write some if/else code on something. server.name is a good candiate.
We took it one step further. We have a server variable effectively called isProduction. We use this variable in our code, in case we have to change servers for some reason.
Copy link to clipboard
Copied
Sounds feasible.
Copy link to clipboard
Copied
I have this now and it has no problem is distinguishing who they are. Would there be any problems in putting this in the Application.cfm file or should I put it elsewhere.
<cfif #cgi.SERVER_NAME# is 'ServerSpecificCriteria'>
<cfset whoami = 'Development'>
<cfelseif #cgi.SERVER_NAME# is 'ServerSpecificCriteria'>
<cfset whoami = 'Production'>
</cfif>
Copy link to clipboard
Copied
application.cfc or cfm will give you the most bang for your buck. Don't make it a local varible though. Put it in the application or session scope
Copy link to clipboard
Copied
Or maybe even the "server" scope!