Kristen Winsor wrote:
> Stephen, Thanks,
>
> Sorry, I have been working on approx 5 hours of sleep each night for the last
> week trying to put into a big project into production so... Am I
> understanding correctly,if I go with "choice 1", change the application name
> to blah cgi.server_name#:#cgi.SERVER_PORT#, I would be okay? That there could
> never be an instance as I named below, where the port number via the URL was
> 82(production), however the banner that the user was seeing was the staging
> server(88) and more importantly, there is no way the user could update the
> staging datasource if they were supposed to be updating the production
> datasource.
>
Close....
Before your <cfapplication> tag in Application.cfm have
<cfif cgi.server_name CONTAINS 'dev'>
<cfset variables.thisAppName = "myapp_dev">
<cfelseif cgi.server_port eq "88"><!--- staging --->
<cfset variables.thisAppName = "myapp_stage">
<cfelseif cgi.server_port eq "82"><!--- this is production --->
<cfset variables.thisAppName ="myapp_production">
</cfif>
then your cfapplication would be :
<cfapplication name="#variables.thisAppName#" .....>
After this set your DSN names.
<cfif NOT StructKeyExists(Application,"DSN")>
<cfif cgi.server_name CONTAINS 'dev'>
<cfset application.dsn = "devData">
<cfset application.fromEmailName = "DevelopmentSite">
<cfelseif cgi.server_port eq "88"><!--- staging --->
<cfset application.dsn = "stageData">
<cfset application.fromEmailName = "StageSite">
<cfelseif cgi.server_port eq "82"><!--- this is production --->
<cfset application.dsn ="prodData">
<cfset application.fromEmailName = "Intranet">
</cfif>
</cfif>
The NOT StructKeyExists() makes sure that you only set application.dsn
etc once and not on every request.
> choice 2. simply, change the Application.dsn to be request.dsn and proceed as
> previsioly detailed. Subsequently, on the 200+ templates all of the queries'
> datasources would have to change from #application.dsn# to the request.dsn
>
Yeah. Thats a bit of a downfall in the plan if you have to change 200+
templates and potentially risky doing a blanket search and replace.
Regards
Stephen
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1603
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54