mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
feat(Core/Config): Implement config override with env vars (#16817)
* Core/Config: Implement config override with env vars Implement overriding of configuration from the .conf file with environment variables. Environment variables keys are autogenerated based on the keys defined in .conf file. Usage example: $ export TC_DATA_DIR=/usr $ AC_WORLD_SERVER_PORT=8080 ./worldserver * Add tests for env vars config
This commit is contained in:
committed by
GitHub
parent
f633e4e9cd
commit
d69ee90ed3
@@ -85,6 +85,8 @@ int main(int argc, char** argv)
|
||||
if (!sConfigMgr->LoadAppConfigs())
|
||||
return 1;
|
||||
|
||||
std::vector<std::string> overriddenKeys = sConfigMgr->OverrideWithEnvVariablesIfAny();
|
||||
|
||||
// Init logging
|
||||
sLog->RegisterAppender<AppenderDB>();
|
||||
sLog->Initialize(nullptr);
|
||||
@@ -101,6 +103,9 @@ int main(int argc, char** argv)
|
||||
LOG_INFO("server.authserver", "> Using Boost version: {}.{}.{}", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
|
||||
});
|
||||
|
||||
for (std::string const& key : overriddenKeys)
|
||||
LOG_INFO("server.authserver", "Configuration field {} was overridden with environment variable.", key);
|
||||
|
||||
OpenSSLCrypto::threadsSetup();
|
||||
|
||||
std::shared_ptr<void> opensslHandle(nullptr, [](void*) { OpenSSLCrypto::threadsCleanup(); });
|
||||
|
||||
Reference in New Issue
Block a user