40 lines
1.7 KiB
Plaintext
40 lines
1.7 KiB
Plaintext
<cfcomponent displayname="Application" output="true" hint="Handle the application.">
|
|
|
|
<cfset this.Name = "contractor"/>
|
|
<cfset this.applicationTimeout = createTimeSpan(0, 0, 3, 0)/>
|
|
<cfset this.sessionmanagement = "Yes"/>
|
|
<cfset this.clientmanagement = "No"/>
|
|
<cfset this.sessiontimeout = CreateTimeSpan(0, 0, 120, 0)/>
|
|
<cfset this.setclientcookies = "No"/>
|
|
|
|
<cfset this.datasource = "baza"/>
|
|
<cfset getDS(this.datasource, "pg")/>
|
|
|
|
<cfsetting requesttimeout="20" showdebugoutput="false" enablecfoutputonly="false"/>
|
|
|
|
<cffunction name="OnApplicationStart" access="public" returntype="boolean" output="false">
|
|
<cfreturn true/>
|
|
</cffunction>
|
|
|
|
<cffunction name="OnRequestStart" access="public" returntype="boolean">
|
|
<cfif structKeyExists(url, "reload")><cfset applicationStop()/></cfif>
|
|
<cfreturn true/>
|
|
</cffunction>
|
|
|
|
<cffunction name="getDS" access="private" returntype="void" output="false">
|
|
<cfargument name="dsname" type="string" required="true"/>
|
|
<cfargument name="prefix" type="string" default="#dsname#"/>
|
|
<cfset system = createObject("java", "java.lang.System")/>
|
|
<cfset var ds = {}/>
|
|
<cfloop list="class,connectionString,database,driver,host,port,type,url,username,password,bundleName,bundleVersion,connectionLimit,liveTimeout,validate" item="field">
|
|
<cfset var value = system.getEnv("#arguments.prefix#_#field#")/>
|
|
<cfif isDefined("value") AND len(value)>
|
|
<cfset structInsert(ds, field, value)/>
|
|
</cfif>
|
|
</cfloop>
|
|
<cfset THIS.datasources[dsname] = ds/>
|
|
<cfreturn/>
|
|
</cffunction>
|
|
|
|
</cfcomponent>
|