Skip to content

Commit

Permalink
Allow TLS enabled connections when providing an established channel (#…
Browse files Browse the repository at this point in the history
…526)

Co-authored-by: Fabian Fett <fabianfett@apple.com>
  • Loading branch information
tkrajacic and fabianfett authored Dec 10, 2024
1 parent 96ed89f commit fd0e415
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,22 @@ extension PostgresConnection {
/// - Parameters:
/// - channel: The `NIOCore/Channel` to use. The channel must already be active and connected to an
/// endpoint (i.e. `NIOCore/Channel/isActive` must be `true`).
/// - tls: The TLS mode to use. Defaults to ``TLS-swift.struct/disable``.
/// - tls: The TLS mode to use.
public init(establishedChannel channel: Channel, tls: PostgresConnection.Configuration.TLS, username: String, password: String?, database: String?) {
self.init(endpointInfo: .configureChannel(channel), tls: tls, username: username, password: password, database: database)
}

/// Create a configuration for establishing a connection to a Postgres server over a preestablished
/// `NIOCore/Channel`.
///
/// This is provided for calling code which wants to manage the underlying connection transport on its
/// own, such as when tunneling a connection through SSH.
///
/// - Parameters:
/// - channel: The `NIOCore/Channel` to use. The channel must already be active and connected to an
/// endpoint (i.e. `NIOCore/Channel/isActive` must be `true`).
public init(establishedChannel channel: Channel, username: String, password: String?, database: String?) {
self.init(endpointInfo: .configureChannel(channel), tls: .disable, username: username, password: password, database: database)
self.init(establishedChannel: channel, tls: .disable, username: username, password: password, database: database)
}

// MARK: - Implementation details
Expand Down

0 comments on commit fd0e415

Please sign in to comment.