aboutsummaryrefslogtreecommitdiff
path: root/src/server/worldserver/Main.cpp
diff options
context:
space:
mode:
authorAnton Popovichenko <walkline.ua@gmail.com>2021-08-19 22:26:16 +0200
committerGitHub <noreply@github.com>2021-08-19 22:26:16 +0200
commit1ddd9dc19cc1df1a1ab8c6123283999f9dea6760 (patch)
treeea726e6ad949923ab18997cc4cf35798ccc7511e /src/server/worldserver/Main.cpp
parent0bdc55b07c9b0d26cd3609ac7313564b7a91efbf (diff)
Core/Config: Implement config override with env vars (#26811)
* 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 $ TC_WORLD_SERVER_PORT=8080 ./worldserver * Core/Config Fix typo in logs Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com> * Core/Config Fix code style in EnvVarForIniKey Co-authored-by: Shauren <shauren.trinity@gmail.com> * Update tests/common/Config.cpp * Apply suggestions from code review Co-authored-by: Peter Keresztes Schmidt <carbenium@outlook.com> * Apply suggestions from code review Co-authored-by: Peter Keresztes Schmidt <carbenium@outlook.com> Co-authored-by: Anton Popovichenko <anton.popovichenko@mendix.com> Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com> Co-authored-by: Shauren <shauren.trinity@gmail.com> Co-authored-by: Peter Keresztes Schmidt <carbenium@outlook.com>
Diffstat (limited to 'src/server/worldserver/Main.cpp')
-rw-r--r--src/server/worldserver/Main.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp
index 079050e4b7e..418b5de5eb1 100644
--- a/src/server/worldserver/Main.cpp
+++ b/src/server/worldserver/Main.cpp
@@ -146,6 +146,8 @@ extern int main(int argc, char** argv)
return 1;
}
+ std::vector<std::string> overriddenKeys = sConfigMgr->OverrideWithEnvVariablesIfAny();
+
std::shared_ptr<Trinity::Asio::IoContext> ioContext = std::make_shared<Trinity::Asio::IoContext>();
sLog->RegisterAppender<AppenderDB>();
@@ -165,6 +167,9 @@ extern int main(int argc, char** argv)
}
);
+ for (std::string const& key : overriddenKeys)
+ TC_LOG_INFO("server.worldserver", "Configuration field '%s' was overridden with environment variable.", key.c_str());
+
OpenSSLCrypto::threadsSetup();
std::shared_ptr<void> opensslHandle(nullptr, [](void*) { OpenSSLCrypto::threadsCleanup(); });