mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 02:04:52 +01:00
Configuration/ConfigMgr: converted from singleton to namespace with free functions.
This commit is contained in:
@@ -91,7 +91,7 @@ extern int main(int argc, char **argv)
|
||||
++c;
|
||||
}
|
||||
|
||||
if (!sConfig->SetSource(cfg_file))
|
||||
if (!ConfigMgr::Load(cfg_file))
|
||||
{
|
||||
sLog->outError("Invalid or missing configuration file : %s", cfg_file);
|
||||
sLog->outError("Verify that the file exists and has \'[authserver]\' written in the top of the file!");
|
||||
@@ -114,7 +114,7 @@ extern int main(int argc, char **argv)
|
||||
sLog->outBasic("Max allowed open files is %d", ACE::max_handles());
|
||||
|
||||
// authserver PID file creation
|
||||
std::string pidfile = sConfig->GetStringDefault("PidFile", "");
|
||||
std::string pidfile = ConfigMgr::GetStringDefault("PidFile", "");
|
||||
if (!pidfile.empty())
|
||||
{
|
||||
uint32 pid = CreatePIDFile(pidfile);
|
||||
@@ -132,12 +132,12 @@ extern int main(int argc, char **argv)
|
||||
return 1;
|
||||
|
||||
// Initialize the log database
|
||||
sLog->SetLogDBLater(sConfig->GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished.
|
||||
sLog->SetLogDBLater(ConfigMgr::GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished.
|
||||
sLog->SetLogDB(false);
|
||||
sLog->SetRealmID(0); // ensure we've set realm to 0 (authserver realmid)
|
||||
|
||||
// Get the list of realms for the server
|
||||
sRealmList->Initialize(sConfig->GetIntDefault("RealmsStateUpdateDelay", 20));
|
||||
sRealmList->Initialize(ConfigMgr::GetIntDefault("RealmsStateUpdateDelay", 20));
|
||||
if (sRealmList->size() == 0)
|
||||
{
|
||||
sLog->outError("No valid realms specified.");
|
||||
@@ -147,8 +147,8 @@ extern int main(int argc, char **argv)
|
||||
// Launch the listening network socket
|
||||
RealmAcceptor acceptor;
|
||||
|
||||
uint16 rmport = sConfig->GetIntDefault("RealmServerPort", 3724);
|
||||
std::string bind_ip = sConfig->GetStringDefault("BindIP", "0.0.0.0");
|
||||
uint16 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724);
|
||||
std::string bind_ip = ConfigMgr::GetStringDefault("BindIP", "0.0.0.0");
|
||||
|
||||
ACE_INET_Addr bind_addr(rmport, bind_ip.c_str());
|
||||
|
||||
@@ -171,7 +171,7 @@ extern int main(int argc, char **argv)
|
||||
{
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
|
||||
uint32 Aff = sConfig->GetIntDefault("UseProcessors", 0);
|
||||
uint32 Aff = ConfigMgr::GetIntDefault("UseProcessors", 0);
|
||||
if (Aff > 0)
|
||||
{
|
||||
ULONG_PTR appAff;
|
||||
@@ -191,7 +191,7 @@ extern int main(int argc, char **argv)
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
bool Prio = sConfig->GetBoolDefault("ProcessPriority", false);
|
||||
bool Prio = ConfigMgr::GetBoolDefault("ProcessPriority", false);
|
||||
|
||||
if (Prio)
|
||||
{
|
||||
@@ -205,7 +205,7 @@ extern int main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
// maximum counter for next ping
|
||||
uint32 numLoops = (sConfig->GetIntDefault("MaxPingTime", 30) * (MINUTE * 1000000 / 100000));
|
||||
uint32 numLoops = (ConfigMgr::GetIntDefault("MaxPingTime", 30) * (MINUTE * 1000000 / 100000));
|
||||
uint32 loopCounter = 0;
|
||||
|
||||
// possibly enable db logging; avoid massive startup spam by doing it here.
|
||||
@@ -248,21 +248,21 @@ bool StartDB()
|
||||
{
|
||||
MySQL::Library_Init();
|
||||
|
||||
std::string dbstring = sConfig->GetStringDefault("LoginDatabaseInfo", "");
|
||||
std::string dbstring = ConfigMgr::GetStringDefault("LoginDatabaseInfo", "");
|
||||
if (dbstring.empty())
|
||||
{
|
||||
sLog->outError("Database not specified");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8 worker_threads = sConfig->GetIntDefault("LoginDatabase.WorkerThreads", 1);
|
||||
uint8 worker_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1);
|
||||
if (worker_threads < 1 || worker_threads > 32)
|
||||
{
|
||||
sLog->outError("Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1.");
|
||||
worker_threads = 1;
|
||||
}
|
||||
|
||||
uint8 synch_threads = sConfig->GetIntDefault("LoginDatabase.SynchThreads", 1);
|
||||
uint8 synch_threads = ConfigMgr::GetIntDefault("LoginDatabase.SynchThreads", 1);
|
||||
if (synch_threads < 1 || synch_threads > 32)
|
||||
{
|
||||
sLog->outError("Improper value specified for LoginDatabase.SynchThreads, defaulting to 1.");
|
||||
|
||||
Reference in New Issue
Block a user