Application.cfc: 23 строки, только хардкод DS
This commit is contained in:
+12
-28
@@ -1,39 +1,23 @@
|
||||
<cfcomponent displayname="Application" output="true" hint="Handle the application.">
|
||||
|
||||
<cfcomponent displayname="Application" output="true">
|
||||
<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")/>
|
||||
|
||||
<cfset this.datasources["baza"] = {
|
||||
class: "org.postgresql.Driver",
|
||||
bundleName: "org.postgresql.jdbc",
|
||||
bundleVersion: "42.6.0",
|
||||
connectionString: "jdbc:postgresql://postgresqlk8s-master.418f9960-2eb7-4429-b2ec-ac64319d7268.svc.cluster.local:5432/baza",
|
||||
username: "super",
|
||||
password: "hoHdkA23yxlD9oMUlZ1bIbNyc6DE2mNJmyHMNkEpVD1F4suQs7O2lyN4t0qITyzt"
|
||||
}/>
|
||||
|
||||
<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">
|
||||
<cffunction name="onRequestStart" access="public" returntype="boolean">
|
||||
<cfargument name="targetPage" type="string" required="true"/>
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user