Code Review
/
ric-plt
/
sdl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Enable redis/sentinel port and sentinel master name configuration
[ric-plt/sdl.git]
/
src
/
configurationreader.cpp
diff --git
a/src/configurationreader.cpp
b/src/configurationreader.cpp
index
1870a87
..
2cd707b
100644
(file)
--- a/
src/configurationreader.cpp
+++ b/
src/configurationreader.cpp
@@
-1,5
+1,5
@@
/*
/*
- Copyright (c) 2018-20
19
Nokia.
+ Copyright (c) 2018-20
22
Nokia.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@
-29,6
+29,7
@@
#include "private/namespaceconfigurations.hpp"
#include "private/namespacevalidator.hpp"
#include "private/system.hpp"
#include "private/namespaceconfigurations.hpp"
#include "private/namespacevalidator.hpp"
#include "private/system.hpp"
+#include <boost/algorithm/string.hpp>
using namespace shareddatalayer;
using namespace shareddatalayer;
@@
-196,17
+197,25
@@
namespace
parseNsConfiguration(namespaceConfigurations, namespaceConfigurationMapItem.first, namespaceConfigurationMapItem.second.first, namespaceConfigurationMapItem.second.second);
}
parseNsConfiguration(namespaceConfigurations, namespaceConfigurationMapItem.first, namespaceConfigurationMapItem.second.first, namespaceConfigurationMapItem.second.second);
}
+ const std::string DEFAULT_REDIS_PORT("6379");
+
void appendDBPortToAddrList(std::string& addresses, const std::string& port)
{
size_t base(0);
void appendDBPortToAddrList(std::string& addresses, const std::string& port)
{
size_t base(0);
+ std::vector<std::string> portList;
+ boost::split(portList, port, boost::is_any_of(","));
+
+ std::size_t idx(0);
+ auto redisPort((portList.size() > 0 && idx < portList.size()) ? portList.at(idx) : DEFAULT_REDIS_PORT);
auto pos = addresses.find(',', base);
while (std::string::npos != pos)
{
auto pos = addresses.find(',', base);
while (std::string::npos != pos)
{
- addresses.insert(pos, ":" +
p
ort);
- base = pos + 2 +
p
ort.size();
+ addresses.insert(pos, ":" +
redisP
ort);
+ base = pos + 2 +
redisP
ort.size();
pos = addresses.find(',', base);
pos = addresses.find(',', base);
+ idx++;
}
}
- addresses.append(":" +
p
ort);
+ addresses.append(":" +
redisP
ort);
}
}
}
}
@@
-357,8
+366,8
@@
void ConfigurationReader::readDatabaseConfiguration(DatabaseConfiguration& datab
if (DatabaseConfiguration::DbType::REDIS_SENTINEL == dbType ||
DatabaseConfiguration::DbType::SDL_SENTINEL_CLUSTER == dbType)
{
if (DatabaseConfiguration::DbType::REDIS_SENTINEL == dbType ||
DatabaseConfiguration::DbType::SDL_SENTINEL_CLUSTER == dbType)
{
- databaseConfiguration.checkAndApplySentinel
Address(dbHostEnvVariableValue + ":" +
sentinelPortEnvVariableValue);
- databaseConfiguration.checkAndApplySentinelMasterName(sentinelMasterNameEnvVariableValue);
+ databaseConfiguration.checkAndApplySentinel
Ports(
sentinelPortEnvVariableValue);
+ databaseConfiguration.checkAndApplySentinelMasterName
s
(sentinelMasterNameEnvVariableValue);
}
}
else
}
}
else