diff --git a/build b/build index 3d9aebb..8c0474e 100644 --- a/build +++ b/build @@ -1 +1 @@ -68 \ No newline at end of file +69 \ No newline at end of file diff --git a/src/Daemon.cpp b/src/Daemon.cpp index 66d7154..17e05ac 100644 --- a/src/Daemon.cpp +++ b/src/Daemon.cpp @@ -51,14 +51,15 @@ namespace OpenWifi { return instance_; } - void Daemon::initialize(Poco::Util::Application &self) { - MicroService::initialize(*this); + void Daemon::initialize() { AssetDir_ = MicroService::instance().ConfigPath("openwifi.restapi.wwwassets"); AccessPolicy_ = MicroService::instance().ConfigGetString("openwifi.document.policy.access", "/wwwassets/access_policy.html"); PasswordPolicy_ = MicroService::instance().ConfigGetString("openwifi.document.policy.password", "/wwwassets/password_policy.html"); - std::cout << AssetDir_ << " .. " << AccessPolicy_ << " .. " << PasswordPolicy_ << std::endl; + } + void MicroServicePostInitialization() { + Daemon()->initialize(); } } diff --git a/src/Daemon.h b/src/Daemon.h index af4dfee..ee50787 100644 --- a/src/Daemon.h +++ b/src/Daemon.h @@ -41,7 +41,7 @@ namespace OpenWifi { const SubSystemVec & SubSystems) : MicroService( PropFile, RootEnv, ConfigEnv, AppName, BusTimer, SubSystems) {}; - void initialize(Poco::Util::Application &self) override; + void initialize(); static Daemon *instance(); inline const std::string & AssetDir() { return AssetDir_; } inline const std::string & GetPasswordPolicy() const { return PasswordPolicy_; } diff --git a/src/framework/MicroService.h b/src/framework/MicroService.h index 75a1536..40e12a2 100644 --- a/src/framework/MicroService.h +++ b/src/framework/MicroService.h @@ -2227,6 +2227,8 @@ namespace OpenWifi { }; + inline class RESTAPI_InternalServer* RESTAPI_InternalServer::instance_ = nullptr; + inline RESTAPI_InternalServer * RESTAPI_InternalServer() { return RESTAPI_InternalServer::instance(); }; class InternalRequestHandlerFactory : public Poco::Net::HTTPRequestHandlerFactory { @@ -2271,7 +2273,6 @@ namespace OpenWifi { return 0; } - struct MicroServiceMeta { uint64_t Id=0; std::string Type; @@ -2526,11 +2527,14 @@ namespace OpenWifi { MyHash_ = CreateHash(MyPublicEndPoint_); } + void MicroServicePostInitialization(); + inline void MicroService::initialize(Poco::Util::Application &self) { // add the default services SubSystems_.push_back(KafkaManager()); SubSystems_.push_back(ALBHealthCheckServer()); SubSystems_.push_back(RESTAPI_server()); + SubSystems_.push_back(RESTAPI_InternalServer()); Poco::Net::initializeSSL(); Poco::Net::HTTPStreamFactory::registerFactory(); @@ -2566,6 +2570,8 @@ namespace OpenWifi { Types::TopicNotifyFunction F = [this](std::string s1,std::string s2) { this->BusMessageReceived(s1,s2); }; KafkaManager()->RegisterTopicWatcher(KafkaTopics::SERVICE_EVENTS, F); + + MicroServicePostInitialization(); } inline void MicroService::uninitialize() {