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:
@ -90,10 +90,17 @@ void ServerApp::reloadSignalHandler(Arch::ThreadSignal, void *)
|
||||
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()
|
||||
{
|
||||
LOG_DEBUG("reload configuration");
|
||||
if (loadConfig(Settings::value(Settings::Server::ExternalConfigFile).toString().toStdString())) {
|
||||
if (loadConfig(currentConfig())) {
|
||||
if (m_server != nullptr) {
|
||||
m_server->setConfig(*m_config);
|
||||
}
|
||||
@ -103,7 +110,7 @@ void ServerApp::reloadConfig()
|
||||
|
||||
void ServerApp::loadConfig()
|
||||
{
|
||||
const auto path = Settings::value(Settings::Server::ExternalConfigFile).toString().toStdString();
|
||||
const auto path = currentConfig();
|
||||
if (path.empty()) {
|
||||
LOG_CRIT("no configuration path provided");
|
||||
bye(s_exitConfig);
|
||||
|
||||
@ -107,6 +107,7 @@ private:
|
||||
std::unique_ptr<ISocketFactory> getSocketFactory() const;
|
||||
NetworkAddress getAddress(const NetworkAddress &address) const;
|
||||
|
||||
std::string currentConfig() const;
|
||||
bool m_suspended = false;
|
||||
Server *m_server = nullptr;
|
||||
ServerState m_serverState = ServerState::Uninitialized;
|
||||
|
||||
Reference in New Issue
Block a user