X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fconfigurationreader.cpp;fp=src%2Fconfigurationreader.cpp;h=2cd707b4301e93f0df2d397fcb504611c10e5026;hb=5bdca62d89d430f607310370fe1391bd1d1bd21a;hp=1870a873b08f7b4547d7ad953cfd0e3eba91c68a;hpb=b4e17e19a35bf714f5ae6c1c041e951ed9de10d4;p=ric-plt%2Fsdl.git diff --git a/src/configurationreader.cpp b/src/configurationreader.cpp index 1870a87..2cd707b 100644 --- a/src/configurationreader.cpp +++ b/src/configurationreader.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2018-2019 Nokia. + Copyright (c) 2018-2022 Nokia. 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 using namespace shareddatalayer; @@ -196,17 +197,25 @@ namespace 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); + std::vector 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) { - addresses.insert(pos, ":" + port); - base = pos + 2 + port.size(); + addresses.insert(pos, ":" + redisPort); + base = pos + 2 + redisPort.size(); pos = addresses.find(',', base); + idx++; } - addresses.append(":" + port); + addresses.append(":" + redisPort); } } @@ -357,8 +366,8 @@ void ConfigurationReader::readDatabaseConfiguration(DatabaseConfiguration& datab if (DatabaseConfiguration::DbType::REDIS_SENTINEL == dbType || DatabaseConfiguration::DbType::SDL_SENTINEL_CLUSTER == dbType) { - databaseConfiguration.checkAndApplySentinelAddress(dbHostEnvVariableValue + ":" + sentinelPortEnvVariableValue); - databaseConfiguration.checkAndApplySentinelMasterName(sentinelMasterNameEnvVariableValue); + databaseConfiguration.checkAndApplySentinelPorts(sentinelPortEnvVariableValue); + databaseConfiguration.checkAndApplySentinelMasterNames(sentinelMasterNameEnvVariableValue); } } else