diff options
author | Anton Popovichenko <walkline.ua@gmail.com> | 2021-08-19 22:26:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-19 22:26:16 +0200 |
commit | 1ddd9dc19cc1df1a1ab8c6123283999f9dea6760 (patch) | |
tree | ea726e6ad949923ab18997cc4cf35798ccc7511e /src/common/Configuration/Config.h | |
parent | 0bdc55b07c9b0d26cd3609ac7313564b7a91efbf (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/common/Configuration/Config.h')
-rw-r--r-- | src/common/Configuration/Config.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/Configuration/Config.h b/src/common/Configuration/Config.h index ce1763b4dfd..3e8dabe8ce3 100644 --- a/src/common/Configuration/Config.h +++ b/src/common/Configuration/Config.h @@ -34,6 +34,9 @@ public: bool LoadInitial(std::string file, std::vector<std::string> args, std::string& error); bool LoadAdditionalFile(std::string file, bool keepOnReload, std::string& error); + /// Overrides configuration with environment variables and returns overridden keys + std::vector<std::string> OverrideWithEnvVariablesIfAny(); + static ConfigMgr* instance(); bool Reload(std::vector<std::string>& errors); |