Skip to content

Commit

Permalink
url config updates (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 authored Jan 15, 2020
1 parent cb6e8a9 commit 4d6b9bb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/PostgresKit/PostgresConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public struct PostgresConfiguration {
internal var _hostname: String?

public init?(url: URL) {
guard url.scheme == "postgres" else {
guard url.scheme?.hasPrefix("postgres") == true else {
return nil
}
guard let username = url.user else {
Expand All @@ -30,8 +30,8 @@ public struct PostgresConfiguration {
}

let tlsConfiguration: TLSConfiguration?
if url.query == "ssl=true" {
tlsConfiguration = TLSConfiguration.forClient(certificateVerification: .none)
if url.query?.contains("ssl=true") == true || url.query?.contains("sslmode=require") == true {
tlsConfiguration = TLSConfiguration.forClient()
} else {
tlsConfiguration = nil
}
Expand Down

0 comments on commit 4d6b9bb

Please sign in to comment.