Skip to content

Commit

Permalink
Just keep the first word case-sensitive.
Browse files Browse the repository at this point in the history
  • Loading branch information
manchurio committed Oct 11, 2022
1 parent c26fae8 commit 1bd3c2f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tools/kvrocks2redis/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ int Config::yesnotoi(std::string input) {
}

Status Config::parseConfigFromString(std::string input) {
auto oldInput = input;
input = Util::ToLower(input);
std::vector<std::string> oldArgs = Util::Split(oldInput, " \t\r\n");
std::vector<std::string> args = Util::Split(input, " \t\r\n");
// omit empty line and comment
if (args.empty() || args[0].front() == '#') return Status::OK();

args[0] = Util::ToLower(args[0]);
size_t size = args.size();
if (size == 2 && args[0] == "daemonize") {
int i;
Expand Down Expand Up @@ -96,7 +94,7 @@ Status Config::parseConfigFromString(std::string input) {
return Status(Status::NotOK, "kvrocks port range should be between 0 and 65535");
}
if (size == 4) {
kvrocks_auth = oldArgs[3];
kvrocks_auth = args[3];
}
} else if (size == 2 && args[0] == "cluster-enable") {
int i;
Expand All @@ -112,7 +110,7 @@ Status Config::parseConfigFromString(std::string input) {
tokens[ns].host = args[1];
tokens[ns].port = std::stoi(args[2]);
if (size >= 4) {
tokens[ns].auth = oldArgs[3];
tokens[ns].auth = args[3];
}
tokens[ns].db_number = size == 5 ? std::atoi(args[4].c_str()) : 0;
} else {
Expand Down

0 comments on commit 1bd3c2f

Please sign in to comment.