Skip to content

Commit 1990fbf

Browse files
authored
Add ability to connect via UNIX socket (vapor#170)
1 parent d70f50b commit 1990fbf

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Sources/PostgresKit/PostgresConfiguration.swift

+20
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,26 @@ public struct PostgresConfiguration {
4545
tlsConfiguration: tlsConfiguration
4646
)
4747
}
48+
49+
public init(
50+
unixDomainSocketPath: String,
51+
username: String,
52+
password: String,
53+
database: String,
54+
encoder: PostgresDataEncoder = PostgresDataEncoder(),
55+
decoder: PostgresDataDecoder = PostgresDataDecoder()
56+
) {
57+
self.address = {
58+
return try SocketAddress.init(unixDomainSocketPath: unixDomainSocketPath)
59+
}
60+
self.username = username
61+
self.password = password
62+
self.database = database
63+
self.tlsConfiguration = nil
64+
self._hostname = nil
65+
self.encoder = encoder
66+
self.decoder = decoder
67+
}
4868

4969
public init(
5070
hostname: String,

0 commit comments

Comments
 (0)