Skip to content
Permalink
Browse files

database-redis: Support password authentication

  • Loading branch information...
sfan5 committed Mar 11, 2017
1 parent d34f149 commit f83d8687a7cd15dac61fd257d358eb42337d48e0
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/database-redis.cpp
@@ -53,6 +53,18 @@ Database_Redis::Database_Redis(Settings &conf)
redisFree(ctx);
throw DatabaseException(err);
}
if (conf.exists("redis_password")) {
tmp = conf.get("redis_password");
redisReply *reply = static_cast<redisReply *>(redisCommand(ctx, "AUTH %s", tmp.c_str()));
if (!reply)
throw DatabaseException("Redis authentication failed");
if (reply->type == REDIS_REPLY_ERROR) {
std::string err = "Redis authentication failed: " + std::string(reply->str, reply->len);
freeReplyObject(reply);
throw DatabaseException(err);
}
freeReplyObject(reply);
}
}

Database_Redis::~Database_Redis()

0 comments on commit f83d868

Please sign in to comment.
You can’t perform that action at this time.