Skip to content

Commit 4d6b9bb

Browse files
authored
url config updates (#166)
1 parent cb6e8a9 commit 4d6b9bb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/PostgresKit/PostgresConfiguration.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public struct PostgresConfiguration {
1313
internal var _hostname: String?
1414

1515
public init?(url: URL) {
16-
guard url.scheme == "postgres" else {
16+
guard url.scheme?.hasPrefix("postgres") == true else {
1717
return nil
1818
}
1919
guard let username = url.user else {
@@ -30,8 +30,8 @@ public struct PostgresConfiguration {
3030
}
3131

3232
let tlsConfiguration: TLSConfiguration?
33-
if url.query == "ssl=true" {
34-
tlsConfiguration = TLSConfiguration.forClient(certificateVerification: .none)
33+
if url.query?.contains("ssl=true") == true || url.query?.contains("sslmode=require") == true {
34+
tlsConfiguration = TLSConfiguration.forClient()
3535
} else {
3636
tlsConfiguration = nil
3737
}

0 commit comments

Comments
 (0)