refactor: moving ServerApp::currentConfig to Settings::serverConfigFile
This commit is contained in:
committed by
Chris Rizzitello
parent
aa54bd329f
commit
727d6ff166
@ -233,6 +233,12 @@ QStringList Settings::validKeys()
|
||||
return Settings::m_validKeys;
|
||||
}
|
||||
|
||||
QString Settings::serverConfigFile()
|
||||
{
|
||||
bool useExt = value(Server::ExternalConfig).toBool();
|
||||
return useExt ? value(Server::ExternalConfigFile).toString() : defaultValue(Server::ExternalConfigFile).toString();
|
||||
}
|
||||
|
||||
bool Settings::isWritable()
|
||||
{
|
||||
return instance()->m_settings->isWritable();
|
||||
|
||||
@ -135,6 +135,7 @@ public:
|
||||
static bool isPortableMode();
|
||||
static QString settingsFile();
|
||||
static QString settingsPath();
|
||||
static QString serverConfigFile();
|
||||
static QString tlsDir();
|
||||
static QString tlsTrustedServersDb();
|
||||
static QString tlsTrustedClientsDb();
|
||||
|
||||
@ -85,17 +85,10 @@ void ServerApp::reloadSignalHandler(Arch::ThreadSignal, void *)
|
||||
events->addEvent(Event(EventTypes::ServerAppReloadConfig, events->getSystemTarget()));
|
||||
}
|
||||
|
||||
QString ServerApp::currentConfig() const
|
||||
{
|
||||
bool useExt = Settings::value(Settings::Server::ExternalConfig).toBool();
|
||||
return useExt ? Settings::value(Settings::Server::ExternalConfigFile).toString()
|
||||
: Settings::defaultValue(Settings::Server::ExternalConfigFile).toString();
|
||||
}
|
||||
|
||||
void ServerApp::reloadConfig()
|
||||
{
|
||||
LOG_DEBUG("reload configuration");
|
||||
if (loadConfig(currentConfig())) {
|
||||
if (loadConfig(Settings::serverConfigFile())) {
|
||||
if (m_server != nullptr) {
|
||||
m_server->setConfig(*m_config);
|
||||
}
|
||||
@ -105,7 +98,7 @@ void ServerApp::reloadConfig()
|
||||
|
||||
void ServerApp::loadConfig()
|
||||
{
|
||||
const auto path = currentConfig();
|
||||
const auto path = Settings::serverConfigFile();
|
||||
if (path.isEmpty()) {
|
||||
LOG_CRIT("no configuration path provided");
|
||||
bye(s_exitConfig);
|
||||
|
||||
@ -106,7 +106,6 @@ private:
|
||||
std::unique_ptr<ISocketFactory> getSocketFactory() const;
|
||||
NetworkAddress getAddress(const NetworkAddress &address) const;
|
||||
|
||||
QString currentConfig() const;
|
||||
bool m_suspended = false;
|
||||
Server *m_server = nullptr;
|
||||
ServerState m_serverState = ServerState::Uninitialized;
|
||||
|
||||
Reference in New Issue
Block a user