/* * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2 * Copyright (C) 2008-2016 TrinityCore * Copyright (C) 2005-2009 MaNGOS */ #ifndef CONFIG_H #define CONFIG_H #include "Common.h" class ConfigMgr { ConfigMgr() = default; ConfigMgr(ConfigMgr const&) = delete; ConfigMgr& operator=(ConfigMgr const&) = delete; ~ConfigMgr() = default; public: static ConfigMgr* instance(); /// Method used only for loading main configuration files (authserver.conf and worldserver.conf) bool LoadInitial(std::string const& file); /** * This method loads additional configuration files * It is recommended to use this method in WorldScript::OnConfigLoad hooks * * @return true if loading was successful */ bool LoadMore(std::string const& file); bool Reload(); bool LoadAppConfigs(std::string const& applicationName = "worldserver"); bool LoadModulesConfigs(); std::string GetStringDefault(std::string const& name, const std::string& def, bool logUnused = true); bool GetBoolDefault(std::string const& name, bool def, bool logUnused = true); int GetIntDefault(std::string const& name, int def, bool logUnused = true); float GetFloatDefault(std::string const& name, float def, bool logUnused = true); std::list GetKeysByString(std::string const& name); bool isDryRun() { return dryRun; } void setDryRun(bool mode) { dryRun = mode; } void SetConfigList(std::string const& fileName, std::string const& modulesConfigList = ""); private: bool dryRun = false; bool LoadData(std::string const& file); }; #define sConfigMgr ConfigMgr::instance() #endif