Skip to content

Commit

Permalink
Log database config
Browse files Browse the repository at this point in the history
  • Loading branch information
samdeane committed Aug 21, 2024
1 parent bf42f34 commit f8db1fd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Sources/LilliputWeb/configure.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ import LeafKit

public func configure(_ app: Application, game: GameConfiguration) throws {

app.databases.use(DatabaseConfigurationFactory.postgres(configuration: .init(
let dbConfig = DatabaseConfigurationFactory.postgres(configuration: .init(
hostname: Environment.get("DATABASE_HOST") ?? "localhost",
port: Environment.get("DATABASE_PORT").flatMap(Int.init(_:)) ?? SQLPostgresConfiguration.ianaPortNumber,
username: Environment.get("DATABASE_USERNAME") ?? "vapor",
password: Environment.get("DATABASE_PASSWORD") ?? "vapor",
database: Environment.get("DATABASE_NAME") ?? game.database,
tls: .prefer(try .init(configuration: .clientDefault)))
), as: .psql)
)

print("LilliputWeb db config \(dbConfig)")

app.databases.use(dbConfig, as: .psql)

app.sessions.use(.fluent)

Expand Down

0 comments on commit f8db1fd

Please sign in to comment.