fix: Application.cfc на cfset, без скрипта
This commit is contained in:
+29
-26
@@ -1,34 +1,37 @@
|
|||||||
component {
|
<cfcomponent displayname="Application" output="true">
|
||||||
this.name = "contractor";
|
|
||||||
this.applicationTimeout = createTimeSpan(0, 0, 3, 0);
|
|
||||||
this.sessionmanagement = true;
|
|
||||||
this.datasource = "baza";
|
|
||||||
this.restEnabled = true;
|
|
||||||
this.restSettings = {skipCFCWithError: true};
|
|
||||||
|
|
||||||
// defaults
|
<cfset this.Name = "contractor"/>
|
||||||
var dbHost = "postgresqlk8s-master.418f9960-2eb7-4429-b2ec-ac64319d7268.svc.cluster.local";
|
<cfset this.applicationTimeout = createTimeSpan(0, 0, 3, 0)/>
|
||||||
var dbPort = "5432";
|
<cfset this.sessionmanagement = true/>
|
||||||
var dbName = "baza";
|
<cfset this.datasource = "baza"/>
|
||||||
|
<cfset this.restEnabled = true/>
|
||||||
|
<cfset this.restSettings = {skipCFCWithError: true}/>
|
||||||
|
|
||||||
// из env или дефолт
|
<cfset sys = createObject("java", "java.lang.System")/>
|
||||||
var sys = createObject("java", "java.lang.System");
|
|
||||||
var user = sys.getenv("DB_USER");
|
|
||||||
if (isNull(user) || !len(user)) user = "super";
|
|
||||||
var pass = sys.getenv("DB_PASS");
|
|
||||||
if (isNull(pass) || !len(pass)) pass = "hoHdkA23yxlD9oMUlZ1bIbNyc6DE2mNJmyHMNkEpVD1F4suQs7O2lyN4t0qITyzt";
|
|
||||||
|
|
||||||
this.datasources["baza"] = {
|
<cfset dbHost = "postgresqlk8s-master.418f9960-2eb7-4429-b2ec-ac64319d7268.svc.cluster.local"/>
|
||||||
|
<cfset dbPort = "5432"/>
|
||||||
|
<cfset dbName = "baza"/>
|
||||||
|
|
||||||
|
<cfset dbUser = sys.getenv("DB_USER")/>
|
||||||
|
<cfif isNull(dbUser) OR NOT len(dbUser)><cfset dbUser = "super"/></cfif>
|
||||||
|
|
||||||
|
<cfset dbPass = sys.getenv("DB_PASS")/>
|
||||||
|
<cfif isNull(dbPass) OR NOT len(dbPass)><cfset dbPass = "hoHdkA23yxlD9oMUlZ1bIbNyc6DE2mNJmyHMNkEpVD1F4suQs7O2lyN4t0qITyzt"/></cfif>
|
||||||
|
|
||||||
|
<cfset this.datasources["baza"] = {
|
||||||
class: "org.postgresql.Driver",
|
class: "org.postgresql.Driver",
|
||||||
bundleName: "org.postgresql.jdbc",
|
bundleName: "org.postgresql.jdbc",
|
||||||
bundleVersion: "42.6.0",
|
bundleVersion: "42.6.0",
|
||||||
connectionString: "jdbc:postgresql://#dbHost#:#dbPort#/#dbName#",
|
connectionString: "jdbc:postgresql://#dbHost#:#dbPort#/#dbName#",
|
||||||
username: user,
|
username: dbUser,
|
||||||
password: pass
|
password: dbPass
|
||||||
};
|
}/>
|
||||||
|
|
||||||
function onRequestStart(targetPage) {
|
<cffunction name="onRequestStart" access="public" returntype="boolean">
|
||||||
if (structKeyExists(url, "reload")) applicationStop();
|
<cfargument name="targetPage" type="string" required="true"/>
|
||||||
return true;
|
<cfif structKeyExists(url, "reload")><cfset applicationStop()/></cfif>
|
||||||
}
|
<cfreturn true/>
|
||||||
}
|
</cffunction>
|
||||||
|
|
||||||
|
</cfcomponent>
|
||||||
|
|||||||
Reference in New Issue
Block a user