Skip to content

Commit

Permalink
Merge pull request #27 from Mordil/remove-authorize
Browse files Browse the repository at this point in the history
Remove `authorize` convenience command method
  • Loading branch information
Mordil authored Mar 28, 2019
2 parents 152eb30 + 2b7b213 commit 0797c3f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
11 changes: 0 additions & 11 deletions Sources/NIORedis/Commands/BasicCommands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ extension RedisClient {
.mapFromRESP()
}

/// Request for authentication in a password-protected Redis server.
///
/// [https://redis.io/commands/auth](https://redis.io/commands/auth)
/// - Parameter password: The password being used to access the Redis server.
/// - Returns: An `EventLoopFuture` that resolves when the connection has been authorized, or fails with a `RedisError`.
@inlinable
public func authorize(with password: String) -> EventLoopFuture<Void> {
return send(command: "AUTH", with: [password])
.map { _ in return () }
}

/// Select the Redis logical database having the specified zero-based numeric index.
/// - Note: New connections always use the database `0`.
///
Expand Down
3 changes: 2 additions & 1 deletion Sources/NIORedis/RedisClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ extension RedisConnection {
guard let pw = password else {
return eventLoopGroup.next().makeSucceededFuture(client)
}
return client.authorize(with: pw)

return client.send(command: "AUTH", with: [pw])
.map { _ in return client }
}
}
Expand Down

0 comments on commit 0797c3f

Please sign in to comment.