From eebe3424a3f603b17e23cc9ffc5931c467e9279e Mon Sep 17 00:00:00 2001 From: Will Homer <392260+devslashwill@users.noreply.github.com> Date: Tue, 11 Feb 2020 22:08:13 +0000 Subject: [PATCH] Add ability to connect via UNIX socket --- .../PostgresKit/PostgresConfiguration.swift | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Sources/PostgresKit/PostgresConfiguration.swift b/Sources/PostgresKit/PostgresConfiguration.swift index d54d42c4..58429264 100644 --- a/Sources/PostgresKit/PostgresConfiguration.swift +++ b/Sources/PostgresKit/PostgresConfiguration.swift @@ -45,6 +45,26 @@ public struct PostgresConfiguration { tlsConfiguration: tlsConfiguration ) } + + public init( + unixDomainSocketPath: String, + username: String, + password: String, + database: String, + encoder: PostgresDataEncoder = PostgresDataEncoder(), + decoder: PostgresDataDecoder = PostgresDataDecoder() + ) { + self.address = { + return try SocketAddress.init(unixDomainSocketPath: unixDomainSocketPath) + } + self.username = username + self.password = password + self.database = database + self.tlsConfiguration = nil + self._hostname = nil + self.encoder = encoder + self.decoder = decoder + } public init( hostname: String,