mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-11-01 11:17:51 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -2632,7 +2632,7 @@ static json DefaultUCentralSchema = R"(
|
|||||||
std::string GitSchema;
|
std::string GitSchema;
|
||||||
if(MicroServiceConfigGetBool("ucentral.datamodel.internal",true)) {
|
if(MicroServiceConfigGetBool("ucentral.datamodel.internal",true)) {
|
||||||
RootSchema_ = DefaultUCentralSchema;
|
RootSchema_ = DefaultUCentralSchema;
|
||||||
Logger().information("Using uCentral validation from built-in default.");
|
poco_information(Logger(),"Using uCentral validation from built-in default.");
|
||||||
Initialized_ = Working_ = true;
|
Initialized_ = Working_ = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2641,7 +2641,7 @@ static json DefaultUCentralSchema = R"(
|
|||||||
auto GitURI = MicroServiceConfigGetString("ucentral.datamodel.uri",GitUCentralJSONSchemaFile);
|
auto GitURI = MicroServiceConfigGetString("ucentral.datamodel.uri",GitUCentralJSONSchemaFile);
|
||||||
if(Utils::wgets(GitURI, GitSchema)) {
|
if(Utils::wgets(GitURI, GitSchema)) {
|
||||||
RootSchema_ = json::parse(GitSchema);
|
RootSchema_ = json::parse(GitSchema);
|
||||||
Logger().information("Using uCentral validation schema from GIT.");
|
poco_information(Logger(),"Using uCentral validation schema from GIT.");
|
||||||
} else {
|
} else {
|
||||||
std::string FileName{ MicroServiceDataDirectory() + "/ucentral.schema.json" };
|
std::string FileName{ MicroServiceDataDirectory() + "/ucentral.schema.json" };
|
||||||
std::ifstream input(FileName);
|
std::ifstream input(FileName);
|
||||||
@@ -2649,11 +2649,11 @@ static json DefaultUCentralSchema = R"(
|
|||||||
schema_file << input.rdbuf();
|
schema_file << input.rdbuf();
|
||||||
input.close();
|
input.close();
|
||||||
RootSchema_ = json::parse(schema_file.str());
|
RootSchema_ = json::parse(schema_file.str());
|
||||||
Logger().information("Using uCentral validation schema from local file.");
|
poco_information(Logger(),"Using uCentral validation schema from local file.");
|
||||||
}
|
}
|
||||||
} catch (const Poco::Exception &E) {
|
} catch (const Poco::Exception &E) {
|
||||||
RootSchema_ = DefaultUCentralSchema;
|
RootSchema_ = DefaultUCentralSchema;
|
||||||
Logger().information("Using uCentral validation from built-in default.");
|
poco_information(Logger(),"Using uCentral validation from built-in default.");
|
||||||
}
|
}
|
||||||
Initialized_ = Working_ = true;
|
Initialized_ = Working_ = true;
|
||||||
}
|
}
|
||||||
@@ -2812,7 +2812,7 @@ static json DefaultUCentralSchema = R"(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ConfigurationValidator::reinitialize([[maybe_unused]] Poco::Util::Application &self) {
|
void ConfigurationValidator::reinitialize([[maybe_unused]] Poco::Util::Application &self) {
|
||||||
Logger().information("Reinitializing.");
|
poco_information(Logger(),"Reinitializing.");
|
||||||
Working_ = Initialized_ = false;
|
Working_ = Initialized_ = false;
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ namespace OpenWifi {
|
|||||||
else
|
else
|
||||||
SvcList += ", " + Svc.second.Type;
|
SvcList += ", " + Svc.second.Type;
|
||||||
}
|
}
|
||||||
logger().information(fmt::format("Current list of microservices: {}", SvcList));
|
poco_information(logger(),fmt::format("Current list of microservices: {}", SvcList));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
poco_error(logger(),fmt::format("KAFKA-MSG: invalid event '{}', missing a field.",Event));
|
poco_error(logger(),fmt::format("KAFKA-MSG: invalid event '{}', missing a field.",Event));
|
||||||
@@ -618,15 +618,15 @@ namespace OpenWifi {
|
|||||||
logger.notice(fmt::format("Starting {} version {}.",DAEMON_APP_NAME, Version()));
|
logger.notice(fmt::format("Starting {} version {}.",DAEMON_APP_NAME, Version()));
|
||||||
|
|
||||||
if(Poco::Net::Socket::supportsIPv6())
|
if(Poco::Net::Socket::supportsIPv6())
|
||||||
logger.information("System supports IPv6.");
|
poco_information(logger,"System supports IPv6.");
|
||||||
else
|
else
|
||||||
logger.information("System does NOT support IPv6.");
|
poco_information(logger,"System does NOT support IPv6.");
|
||||||
|
|
||||||
if (config().getBool("application.runAsDaemon", false)) {
|
if (config().getBool("application.runAsDaemon", false)) {
|
||||||
logger.information("Starting as a daemon.");
|
poco_information(logger,"Starting as a daemon.");
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.information(fmt::format("System ID set to {}",ID_));
|
poco_information(logger,fmt::format("System ID set to {}",ID_));
|
||||||
StartSubSystemServers();
|
StartSubSystemServers();
|
||||||
waitForTerminationRequest();
|
waitForTerminationRequest();
|
||||||
StopSubSystemServers();
|
StopSubSystemServers();
|
||||||
|
|||||||
@@ -30,15 +30,15 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline int Start() override {
|
inline int Start() override {
|
||||||
Logger().information("Starting.");
|
poco_information(Logger(),"Starting.");
|
||||||
Server_.InitLogging();
|
Server_.InitLogging();
|
||||||
|
|
||||||
for(const auto & Svr: ConfigServersList_) {
|
for(const auto & Svr: ConfigServersList_) {
|
||||||
|
|
||||||
if(MicroServiceNoAPISecurity()) {
|
if(MicroServiceNoAPISecurity()) {
|
||||||
Logger().information(fmt::format("Starting: {}:{}. Security has been disabled for APIs.", Svr.Address(), Svr.Port()));
|
poco_information(Logger(),fmt::format("Starting: {}:{}. Security has been disabled for APIs.", Svr.Address(), Svr.Port()));
|
||||||
} else {
|
} else {
|
||||||
Logger().information(fmt::format("Starting: {}:{} Keyfile:{} CertFile: {}", Svr.Address(), Svr.Port(),
|
poco_information(Logger(),fmt::format("Starting: {}:{} Keyfile:{} CertFile: {}", Svr.Address(), Svr.Port(),
|
||||||
Svr.KeyFile(),Svr.CertFile()));
|
Svr.KeyFile(),Svr.CertFile()));
|
||||||
Svr.LogCert(Logger());
|
Svr.LogCert(Logger());
|
||||||
if (!Svr.RootCA().empty())
|
if (!Svr.RootCA().empty())
|
||||||
@@ -64,18 +64,18 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void Stop() override {
|
inline void Stop() override {
|
||||||
Logger().information("Stopping...");
|
poco_information(Logger(),"Stopping...");
|
||||||
for( const auto & svr : RESTServers_ )
|
for( const auto & svr : RESTServers_ )
|
||||||
svr->stopAll(true);
|
svr->stopAll(true);
|
||||||
Pool_.stopAll();
|
Pool_.stopAll();
|
||||||
Pool_.joinAll();
|
Pool_.joinAll();
|
||||||
RESTServers_.clear();
|
RESTServers_.clear();
|
||||||
Logger().information("Stopped...");
|
poco_information(Logger(),"Stopped...");
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void reinitialize([[maybe_unused]] Poco::Util::Application &self) override {
|
inline void reinitialize([[maybe_unused]] Poco::Util::Application &self) override {
|
||||||
MicroServiceLoadConfigurationFile();
|
MicroServiceLoadConfigurationFile();
|
||||||
Logger().information("Reinitializing.");
|
poco_information(Logger(),"Reinitializing.");
|
||||||
Stop();
|
Stop();
|
||||||
Start();
|
Start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,15 +30,15 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline int Start() override {
|
inline int Start() override {
|
||||||
Logger().information("Starting.");
|
poco_information(Logger(),"Starting.");
|
||||||
Server_.InitLogging();
|
Server_.InitLogging();
|
||||||
|
|
||||||
for(const auto & Svr: ConfigServersList_) {
|
for(const auto & Svr: ConfigServersList_) {
|
||||||
|
|
||||||
if(MicroServiceNoAPISecurity()) {
|
if(MicroServiceNoAPISecurity()) {
|
||||||
Logger().information(fmt::format("Starting: {}:{}. Security has been disabled for APIs.", Svr.Address(), Svr.Port()));
|
poco_information(Logger(),fmt::format("Starting: {}:{}. Security has been disabled for APIs.", Svr.Address(), Svr.Port()));
|
||||||
} else {
|
} else {
|
||||||
Logger().information(fmt::format("Starting: {}:{}. Keyfile:{} CertFile: {}", Svr.Address(), Svr.Port(),
|
poco_information(Logger(),fmt::format("Starting: {}:{}. Keyfile:{} CertFile: {}", Svr.Address(), Svr.Port(),
|
||||||
Svr.KeyFile(),Svr.CertFile()));
|
Svr.KeyFile(),Svr.CertFile()));
|
||||||
Svr.LogCert(Logger());
|
Svr.LogCert(Logger());
|
||||||
if (!Svr.RootCA().empty())
|
if (!Svr.RootCA().empty())
|
||||||
@@ -65,17 +65,17 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void Stop() override {
|
inline void Stop() override {
|
||||||
Logger().information("Stopping...");
|
poco_information(Logger(),"Stopping...");
|
||||||
for( const auto & svr : RESTServers_ )
|
for( const auto & svr : RESTServers_ )
|
||||||
svr->stopAll(true);
|
svr->stopAll(true);
|
||||||
Pool_.stopAll();
|
Pool_.stopAll();
|
||||||
Pool_.joinAll();
|
Pool_.joinAll();
|
||||||
Logger().information("Stopped...");
|
poco_information(Logger(),"Stopped...");
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void reinitialize([[maybe_unused]] Poco::Util::Application &self) override {
|
inline void reinitialize([[maybe_unused]] Poco::Util::Application &self) override {
|
||||||
MicroServiceLoadConfigurationFile();
|
MicroServiceLoadConfigurationFile();
|
||||||
Logger().information("Reinitializing.");
|
poco_information(Logger(),"Reinitializing.");
|
||||||
Stop();
|
Stop();
|
||||||
Start();
|
Start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace OpenWifi {
|
|||||||
auto Name = GetS(RESTAPI::Protocol::TAG, InnerObj);
|
auto Name = GetS(RESTAPI::Protocol::TAG, InnerObj);
|
||||||
auto Value = GetS(RESTAPI::Protocol::VALUE, InnerObj);
|
auto Value = GetS(RESTAPI::Protocol::VALUE, InnerObj);
|
||||||
MicroServiceSetSubsystemLogLevel(Name, Value);
|
MicroServiceSetSubsystemLogLevel(Name, Value);
|
||||||
Logger_.information(
|
poco_information(Logger_,
|
||||||
fmt::format("Setting log level for {} at {}", Name, Value));
|
fmt::format("Setting log level for {} at {}", Name, Value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onPrivateKeyRequested([[maybe_unused]] const void * pSender,std::string & privateKey) {
|
void onPrivateKeyRequested([[maybe_unused]] const void * pSender,std::string & privateKey) {
|
||||||
Logger_.information("Returning key passphrase.");
|
poco_information(Logger_,"Returning key passphrase.");
|
||||||
privateKey = Password_;
|
privateKey = Password_;
|
||||||
};
|
};
|
||||||
inline Poco::Logger & Logger() { return Logger_; }
|
inline Poco::Logger & Logger() { return Logger_; }
|
||||||
@@ -83,7 +83,7 @@ namespace OpenWifi {
|
|||||||
inline void uninitialize() override {
|
inline void uninitialize() override {
|
||||||
}
|
}
|
||||||
inline void reinitialize([[maybe_unused]] Poco::Util::Application &self) override {
|
inline void reinitialize([[maybe_unused]] Poco::Util::Application &self) override {
|
||||||
Logger_->L_.information("Reloading of this subsystem is not supported.");
|
poco_information(Logger_->L_,"Reloading of this subsystem is not supported.");
|
||||||
}
|
}
|
||||||
inline void defineOptions([[maybe_unused]] Poco::Util::OptionSet &options) override {
|
inline void defineOptions([[maybe_unused]] Poco::Util::OptionSet &options) override {
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user