mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 18:36:31 +01:00
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>
This commit is contained in:
committed by
GitHub
parent
0bdc55b07c
commit
1ddd9dc19c
@@ -108,6 +108,8 @@ int main(int argc, char** argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::vector<std::string> overriddenKeys = sConfigMgr->OverrideWithEnvVariablesIfAny();
|
||||
|
||||
sLog->RegisterAppender<AppenderDB>();
|
||||
sLog->Initialize(nullptr);
|
||||
|
||||
@@ -124,6 +126,9 @@ int main(int argc, char** argv)
|
||||
}
|
||||
);
|
||||
|
||||
for (std::string const& key : overriddenKeys)
|
||||
TC_LOG_INFO("server.authserver", "Configuration field '%s' was overridden with environment variable.", key.c_str());
|
||||
|
||||
// authserver PID file creation
|
||||
std::string pidFile = sConfigMgr->GetStringDefault("PidFile", "");
|
||||
if (!pidFile.empty())
|
||||
|
||||
Reference in New Issue
Block a user