Skip to content

Commit

Permalink
removed deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
samdeane committed Aug 20, 2024
1 parent 8042114 commit 0c317ef
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Sources/LilliputWeb/configure.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ import LeafKit
// configures your application

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

var tls = PostgresConnection.Configuration.TLS.disable // TODO: fix this?

if let databaseURL = Environment.get("DATABASE_URL"), var postgresConfig = PostgresConfiguration(url: databaseURL) {
var configuration: TLSConfiguration = .makeClientConfiguration()
configuration.certificateVerification = .none
postgresConfig.tlsConfiguration = configuration
app.databases.use(.postgres(
configuration: postgresConfig
), as: .psql)
var postgresConfig: SQLPostgresConfiguration
if let databaseURL = Environment.get("DATABASE_URL") {
postgresConfig = try SQLPostgresConfiguration(url: databaseURL)
} else {
app.databases.use(.postgres(hostname: "localhost", username: "vapor", password: "vapor", database: game.database), as: .psql)
postgresConfig = SQLPostgresConfiguration(hostname: "localhost", username: "vapor", password: "vapor", database: game.database, tls: tls)
}
app.databases.use(.postgres(configuration: postgresConfig), as: .psql)
app.sessions.use(.fluent)

setupMigrations(app)
Expand Down

0 comments on commit 0c317ef

Please sign in to comment.