diff --git a/Application.cfc b/Application.cfc index 39549ca..caa4626 100644 --- a/Application.cfc +++ b/Application.cfc @@ -1,153 +1,34 @@ - - +component { + this.name = "contractor"; + this.applicationTimeout = createTimeSpan(0, 0, 3, 0); + this.sessionmanagement = true; + this.datasource = "baza"; + this.restEnabled = true; + this.restSettings = {skipCFCWithError: true}; - - - - - - - - - - - - - - - - - + // defaults + var dbHost = "postgresqlk8s-master.418f9960-2eb7-4429-b2ec-ac64319d7268.svc.cluster.local"; + var dbPort = "5432"; + var dbName = "baza"; - - - - + // из env или дефолт + 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"] = { + class: "org.postgresql.Driver", + bundleName: "org.postgresql.jdbc", + bundleVersion: "42.6.0", + connectionString: "jdbc:postgresql://#dbHost#:#dbPort#/#dbName#", + username: user, + password: pass + }; - - - - - - - - - - - - - - - - - - - - - - - - - - - - ), - DE( "https://" ), - DE( "http://" ) - ) & - cgi.http_host & - reReplace( - getDirectoryFromPath( arguments.template ), "([^\\/]+[\\/]){#local.requestDepth#}$", - "", - "one" - ) - ) /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + function onRequestStart(targetPage) { + if (structKeyExists(url, "reload")) applicationStop(); + return true; + } +}