fix: ServerApp, do not blindly read the external config path for our settings location
use the default value unless the setting for using the external config is also set fixes: #9227
This commit is contained in:
parent
d35716f574
commit
fd94403a73
2 changed files with 10 additions and 2 deletions
|
|
@ -90,10 +90,17 @@ void ServerApp::reloadSignalHandler(Arch::ThreadSignal, void *)
|
||||||
events->addEvent(Event(EventTypes::ServerAppReloadConfig, events->getSystemTarget()));
|
events->addEvent(Event(EventTypes::ServerAppReloadConfig, events->getSystemTarget()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ServerApp::currentConfig() const
|
||||||
|
{
|
||||||
|
bool useExt = Settings::value(Settings::Server::ExternalConfig).toBool();
|
||||||
|
return useExt ? Settings::value(Settings::Server::ExternalConfigFile).toString().toStdString()
|
||||||
|
: Settings::defaultValue(Settings::Server::ExternalConfigFile).toString().toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
void ServerApp::reloadConfig()
|
void ServerApp::reloadConfig()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("reload configuration");
|
LOG_DEBUG("reload configuration");
|
||||||
if (loadConfig(Settings::value(Settings::Server::ExternalConfigFile).toString().toStdString())) {
|
if (loadConfig(currentConfig())) {
|
||||||
if (m_server != nullptr) {
|
if (m_server != nullptr) {
|
||||||
m_server->setConfig(*m_config);
|
m_server->setConfig(*m_config);
|
||||||
}
|
}
|
||||||
|
|
@ -103,7 +110,7 @@ void ServerApp::reloadConfig()
|
||||||
|
|
||||||
void ServerApp::loadConfig()
|
void ServerApp::loadConfig()
|
||||||
{
|
{
|
||||||
const auto path = Settings::value(Settings::Server::ExternalConfigFile).toString().toStdString();
|
const auto path = currentConfig();
|
||||||
if (path.empty()) {
|
if (path.empty()) {
|
||||||
LOG_CRIT("no configuration path provided");
|
LOG_CRIT("no configuration path provided");
|
||||||
bye(s_exitConfig);
|
bye(s_exitConfig);
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ private:
|
||||||
std::unique_ptr<ISocketFactory> getSocketFactory() const;
|
std::unique_ptr<ISocketFactory> getSocketFactory() const;
|
||||||
NetworkAddress getAddress(const NetworkAddress &address) const;
|
NetworkAddress getAddress(const NetworkAddress &address) const;
|
||||||
|
|
||||||
|
std::string currentConfig() const;
|
||||||
bool m_suspended = false;
|
bool m_suspended = false;
|
||||||
Server *m_server = nullptr;
|
Server *m_server = nullptr;
|
||||||
ServerState m_serverState = ServerState::Uninitialized;
|
ServerState m_serverState = ServerState::Uninitialized;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue