CF Snippets

Using Environment Variables in Datasource Configuration

Use environment variables for datasource configuration using the server.system.environment struct of environment variables.

this.datasources["myApp"] = {
  class: "com.microsoft.sqlserver.jdbc.SQLServerDriver"
  , bundleName: "mssqljdbc4"
  , bundleVersion: "4.0.2206.100"
  , connectionString: "jdbc:sqlserver://localhost:1433;DATABASENAME=#server.system.environment.DB_NAME#;sendStringParametersAsUnicode=true;SelectMethod=direct"
  , username: server.system.environment.DB_USER
  , password: server.system.environment.DB_PASS
};