<cfcomponent
output="false"
hint="I define the application settings and event handlers.">
hi, im using flash remoting to call cfcs and I want to use this application.cfc to determine the environment (the APPLICATION.environment defines a DSN used in the cfcs flash calls).
however everytime I call a cfc with this app.cfc I get a error from CF which I can't debug because CF builder is uselss for connecting to debuggers. Any ideas?
<!--- Define the application. --->
<cfset this.name = hash( getCurrentTemplatePath() ) />
<cfset this.applicationTimeout = createTimeSpan( 0, 0, 1, 0 ) />
<cffunction name="onApplicationStart" output="false">
<cfset path = cgi.SERVER_NAME & cgi.SCRIPT_NAME>
<cfset serverAnd2Dirs = reFind("([\w-]+/\w+/\w+)",path,0,true)>
<cfset match = mid(path, serverAnd2Dirs.pos[1], serverAnd2Dirs.len[1]) >
<cfset var identifier = createObject("component","DomainEnvironmentIdentifier").init(match)>
<cfset var environment = createObject("component","Environment" ).init(expandPath('/')&"coldfusion\config\environments.xml.cfm")>
<cfset environment.use( identifier.currentEnvironment() )>
<cfset APPLICATION.environment = this.environment>
</cffunction>
</cfcomponent>