From 0c317ef01163484812e2b0f55e91cc893542c17e Mon Sep 17 00:00:00 2001 From: Sam Deane Date: Tue, 20 Aug 2024 16:10:35 +0100 Subject: [PATCH] removed deprecations --- Sources/LilliputWeb/configure.swift | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Sources/LilliputWeb/configure.swift b/Sources/LilliputWeb/configure.swift index d369268..8811162 100644 --- a/Sources/LilliputWeb/configure.swift +++ b/Sources/LilliputWeb/configure.swift @@ -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)