Author: Not specified Language: javascript
Description: (v3) Timestamp: 2018-06-23 18:46:52 +0000
View raw paste Parent paste by: Not specified - Child paste by: Not specified Reply
let hostname = Environment.get("DATABASE_HOSTNAME") ?? "localhost"
let username = Environment.get("DATABASE_USER") ?? "vapor"
let databaseName = Environment.get("DATABASE_DB") ?? "vapor"
let password = Environment.get("DATABASE_PASSWORD") ?? "password"

let databaseConfig = PostgreSQLDatabaseConfig(
    hostname: hostname,
    username: username,
    database: databaseName,
    password: password
)

let database = PostgreSQLDatabase(config: databaseConfig)
var databases = DatabasesConfig()
databases.add(database: database, as: .psql)
services.register(databases)
View raw paste Parent paste by: Not specified - Child paste by: Not specified Reply