Closed thoven87 closed 3 hours ago
You can just do this:
var tlsConfig = TLSConfiguration.makeClientConfiguration()
tlsConfig.certificateVerification = .none
var config = PostgresClient.Configuration(
host: env.get("POSTGRES_HOST") ?? "localhost",
port: env.get("POSTGRES_PORT", as: Int.self) ?? 5432,
username: env.get("POSTGRES_USERNAME") ?? "postgres",
password: env.get("POSTGRES_PASSWORD") ?? "postgres",
database: env.get("POSTGRES_DATABASE") ?? "postgres",
tls: .prefer(tlsConfig)
)
You can just do this:
var tlsConfig = TLSConfiguration.makeClientConfiguration() tlsConfig.certificateVerification = .none var config = PostgresClient.Configuration( host: env.get("POSTGRES_HOST") ?? "localhost", port: env.get("POSTGRES_PORT", as: Int.self) ?? 5432, username: env.get("POSTGRES_USERNAME") ?? "postgres", password: env.get("POSTGRES_PASSWORD") ?? "postgres", database: env.get("POSTGRES_DATABASE") ?? "postgres", tls: .prefer(tlsConfig) )
Thank You!
Is your feature request related to a problem? Please describe. Allow user to specify TLS configuration options.
Previously, one could do the the following to connect to server with self signed certificates
forClient(certificateVerification: .none))
forClient
is deprecated andmakeClientConfiguration()
is the preferred TLS config options,One cannot update the TLS configuration as suggested in the doc
Describe the solution you'd like I would love for
makeClientConfiguration
to accept some arguments which allow overriding some of the options or drop deprecated status for bothforClient
andforServer
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context I experienced the connection failure when attempting to connect to a Postgres instance where the certificate was self signed.