#include "Config.h"
#include "Log.h"
#include "StringConvert.h"
#include "StringFormat.h"
#include "Tokenize.h"
#include "Util.h"
#include <cstdlib>
#include <fstream>
#include <mutex>
#include <unordered_map>
Go to the source code of this file.
|
bool | anonymous_namespace{Config.cpp}::IsAppConfig (std::string_view fileName) |
|
bool | anonymous_namespace{Config.cpp}::IsLoggingSystemOptions (std::string_view optionName) |
|
template<typename Format , typename... Args> |
void | anonymous_namespace{Config.cpp}::PrintError (std::string_view filename, Format &&fmt, Args &&... args) |
|
void | anonymous_namespace{Config.cpp}::AddKey (std::string const &optionName, std::string const &optionKey, std::string_view fileName, bool isOptional, bool isReload) |
|
bool | anonymous_namespace{Config.cpp}::ParseFile (std::string const &file, bool isOptional, bool isReload) |
|
bool | anonymous_namespace{Config.cpp}::LoadFile (std::string const &file, bool isOptional, bool isReload) |
|
std::string | anonymous_namespace{Config.cpp}::IniKeyToEnvVarKey (std::string const &key) |
|
Optional< std::string > | anonymous_namespace{Config.cpp}::EnvVarForIniKey (std::string const &key) |
|
template<> |
std::string | ConfigMgr::GetValueDefault< std::string > (std::string const &name, std::string const &def, bool showLogs) const |
|
◆ TEMPLATE_CONFIG_OPTION
#define TEMPLATE_CONFIG_OPTION |
( |
|
__typename | ) |
template __typename ConfigMgr::GetOption<__typename>(std::string const& name, __typename const& def, bool showLogs /*= true*/) const; |
◆ ConfigMgr::GetValueDefault< std::string >()
404{
407 {
409 if (envVar)
410 {
411 if (showLogs)
412 {
413 LOG_WARN(
"server.loading",
"Missing property {} in config file {}, recovered with environment '{}' value.",
414 name.c_str(),
_filename.c_str(), envVar->c_str());
415 }
416
417 return *envVar;
418 }
419
420 if (showLogs)
421 {
422 LOG_ERROR(
"server.loading",
"> Config: Missing property {} in config file {}, add \"{} = {}\" to this file.",
424 }
425
426 return def;
427 }
428
429 return itr->second;
430}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:159
#define LOG_WARN(filterType__,...)
Definition: Log.h:163
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:24
Optional< std::string > EnvVarForIniKey(std::string const &key)
Definition: Config.cpp:285
std::unordered_map< std::string, std::string > _configOptions
Definition: Config.cpp:34
std::string _filename
Definition: Config.cpp:31
References anonymous_namespace{Config.cpp}::_configOptions, anonymous_namespace{Config.cpp}::_filename, anonymous_namespace{Config.cpp}::EnvVarForIniKey(), LOG_ERROR, and LOG_WARN.