diff --git a/README.md b/README.md index 4f0a745..8f60207 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ and run the following command: `swift package resolve` import RedisNIO let connection = Redis.makeConnection( - to: try .init(ipAddress: "127.0.0.1", port: 6379), + to: try .init(ipAddress: "127.0.0.1", port: RedisConnection.defaultPort), password: "my_pass" ).wait() diff --git a/Sources/RedisNIO/Redis.swift b/Sources/RedisNIO/Redis.swift index 07a513c..70952c3 100644 --- a/Sources/RedisNIO/Redis.swift +++ b/Sources/RedisNIO/Redis.swift @@ -64,7 +64,7 @@ extension Redis { /// /// let elg = MultiThreadedEventLoopGroup(numberOfThreads: 3) /// let connection = Redis.makeConnection( - /// to: .init(ipAddress: "127.0.0.1", port: 6379), + /// to: .init(ipAddress: "127.0.0.1", port: RedisConnection.defaultPort), /// using: elg, /// password: "my_pass" /// ) diff --git a/Sources/RedisNIO/RedisClient.swift b/Sources/RedisNIO/RedisClient.swift index d0fada0..cc3a692 100644 --- a/Sources/RedisNIO/RedisClient.swift +++ b/Sources/RedisNIO/RedisClient.swift @@ -56,6 +56,8 @@ private let loggingKeyID = "RedisConnection" /// /// See `RedisClient` public final class RedisConnection: RedisClient { + public static let defaultPort = 6379 + private enum ConnectionState { case open case closed diff --git a/Tests/RedisNIOTests/Utilities/RedisConnection.swift b/Tests/RedisNIOTests/Utilities/RedisConnection.swift index 70df73e..5b1671d 100644 --- a/Tests/RedisNIOTests/Utilities/RedisConnection.swift +++ b/Tests/RedisNIOTests/Utilities/RedisConnection.swift @@ -19,7 +19,10 @@ extension Redis { static func makeConnection() throws -> EventLoopFuture { let env = ProcessInfo.processInfo.environment return Redis.makeConnection( - to: try .makeAddressResolvingHost(env["REDIS_URL"] ?? "127.0.0.1", port: 6379), + to: try .makeAddressResolvingHost( + env["REDIS_URL"] ?? "127.0.0.1", + port: RedisConnection.defaultPort + ), password: env["REDIS_PW"] ) }