Update client libs for test_runner/pg_clients to their latest versions (#4092)

Also, use Workaround D for `swift/PostgresClientKitExample`, 
which supports neither SNI nor connections options
This commit is contained in:
Alexander Bayandin
2023-05-04 18:22:04 +01:00
committed by GitHub
parent 88f39c11d4
commit 291b4f0d41
21 changed files with 375 additions and 211 deletions

View File

@@ -1,11 +1,11 @@
FROM swift:5.7 AS build
FROM swift:5.8 AS build
RUN apt-get -q update && apt-get -q install -y libssl-dev
WORKDIR /source
COPY . .
RUN swift build --configuration release
FROM swift:5.7
FROM swift:5.8
WORKDIR /app
COPY --from=build /source/.build/release .
CMD ["/app/PostgresClientKitExample"]

View File

@@ -1,4 +1,4 @@
// swift-tools-version:5.7
// swift-tools-version:5.8
import PackageDescription
let package = Package(

View File

@@ -3,21 +3,22 @@ import Foundation
import PostgresClientKit
do {
var configuration = PostgresClientKit.ConnectionConfiguration()
let env = ProcessInfo.processInfo.environment
if let host = env["NEON_HOST"] {
configuration.host = host
}
if let database = env["NEON_DATABASE"] {
configuration.database = database
}
if let user = env["NEON_USER"] {
configuration.user = user
}
if let password = env["NEON_PASSWORD"] {
configuration.credential = .cleartextPassword(password: password)
}
var configuration = PostgresClientKit.ConnectionConfiguration()
let host = env["NEON_HOST"] ?? ""
configuration.host = host
configuration.port = 5432
configuration.database = env["NEON_DATABASE"] ?? ""
configuration.user = env["NEON_USER"] ?? ""
// PostgresClientKit uses Kitura/BlueSSLService which doesn't support SNI
// PostgresClientKit doesn't support setting connection options, so we use "Workaround D"
// See https://neon.tech/sni
let password = env["NEON_PASSWORD"] ?? ""
let endpoint_id = host.split(separator: ".")[0]
let workaroundD = "project=\(endpoint_id);\(password)"
configuration.credential = .cleartextPassword(password: workaroundD)
let connection = try PostgresClientKit.Connection(configuration: configuration)
defer { connection.close() }