mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 10:00:28 +00:00
feat(Core/Config): rework config and delete ACE inherited (#4608)
This commit is contained in:
@@ -136,7 +136,7 @@ int Master::Run()
|
||||
sLog->outString(" AzerothCore 3.3.5a - www.azerothcore.org\n");
|
||||
|
||||
/// worldserver PID file creation
|
||||
std::string pidFile = sConfigMgr->GetStringDefault("PidFile", "");
|
||||
std::string pidFile = sConfigMgr->GetOption<std::string>("PidFile", "");
|
||||
if (!pidFile.empty())
|
||||
{
|
||||
if (uint32 pid = CreatePIDFile(pidFile))
|
||||
@@ -185,9 +185,9 @@ int Master::Run()
|
||||
acore::Thread* cliThread = nullptr;
|
||||
|
||||
#ifdef _WIN32
|
||||
if (sConfigMgr->GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/)
|
||||
if (sConfigMgr->GetOption<bool>("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/)
|
||||
#else
|
||||
if (sConfigMgr->GetBoolDefault("Console.Enable", true))
|
||||
if (sConfigMgr->GetOption<bool>("Console.Enable", true))
|
||||
#endif
|
||||
{
|
||||
///- Launch CliRunnable thread
|
||||
@@ -203,8 +203,8 @@ int Master::Run()
|
||||
#if defined(_WIN32) || defined(__linux__)
|
||||
|
||||
///- Handle affinity for multiple processors and process priority
|
||||
uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0);
|
||||
bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false);
|
||||
uint32 affinity = sConfigMgr->GetOption<int32>("UseProcessors", 0);
|
||||
bool highPriority = sConfigMgr->GetOption<bool>("ProcessPriority", false);
|
||||
|
||||
#ifdef _WIN32 // Windows
|
||||
|
||||
@@ -270,16 +270,16 @@ int Master::Run()
|
||||
|
||||
// Start soap serving thread
|
||||
acore::Thread* soapThread = nullptr;
|
||||
if (sConfigMgr->GetBoolDefault("SOAP.Enabled", false))
|
||||
if (sConfigMgr->GetOption<bool>("SOAP.Enabled", false))
|
||||
{
|
||||
ACSoapRunnable* runnable = new ACSoapRunnable();
|
||||
runnable->SetListenArguments(sConfigMgr->GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfigMgr->GetIntDefault("SOAP.Port", 7878)));
|
||||
runnable->SetListenArguments(sConfigMgr->GetOption<std::string>("SOAP.IP", "127.0.0.1"), uint16(sConfigMgr->GetOption<int32>("SOAP.Port", 7878)));
|
||||
soapThread = new acore::Thread(runnable);
|
||||
}
|
||||
|
||||
// Start up freeze catcher thread
|
||||
acore::Thread* freezeThread = nullptr;
|
||||
if (uint32 freezeDelay = sConfigMgr->GetIntDefault("MaxCoreStuckTime", 0))
|
||||
if (uint32 freezeDelay = sConfigMgr->GetOption<int32>("MaxCoreStuckTime", 0))
|
||||
{
|
||||
FreezeDetectorRunnable* runnable = new FreezeDetectorRunnable(freezeDelay * 1000);
|
||||
freezeThread = new acore::Thread(runnable);
|
||||
@@ -288,7 +288,7 @@ int Master::Run()
|
||||
|
||||
///- Launch the world listener socket
|
||||
uint16 worldPort = uint16(sWorld->getIntConfig(CONFIG_PORT_WORLD));
|
||||
std::string bindIp = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0");
|
||||
std::string bindIp = sConfigMgr->GetOption<std::string>("BindIP", "0.0.0.0");
|
||||
if (sWorldSocketMgr->StartNetwork(worldPort, bindIp.c_str()) == -1)
|
||||
{
|
||||
sLog->outError("Failed to start network");
|
||||
@@ -398,14 +398,14 @@ bool Master::_StartDB()
|
||||
std::string dbstring;
|
||||
uint8 async_threads, synch_threads;
|
||||
|
||||
dbstring = sConfigMgr->GetStringDefault("WorldDatabaseInfo", "");
|
||||
dbstring = sConfigMgr->GetOption<std::string>("WorldDatabaseInfo", "");
|
||||
if (dbstring.empty())
|
||||
{
|
||||
sLog->outError("World database not specified in configuration file");
|
||||
return false;
|
||||
}
|
||||
|
||||
async_threads = uint8(sConfigMgr->GetIntDefault("WorldDatabase.WorkerThreads", 1));
|
||||
async_threads = uint8(sConfigMgr->GetOption<int32>("WorldDatabase.WorkerThreads", 1));
|
||||
if (async_threads < 1 || async_threads > 32)
|
||||
{
|
||||
sLog->outError("World database: invalid number of worker threads specified. "
|
||||
@@ -413,7 +413,7 @@ bool Master::_StartDB()
|
||||
return false;
|
||||
}
|
||||
|
||||
synch_threads = uint8(sConfigMgr->GetIntDefault("WorldDatabase.SynchThreads", 1));
|
||||
synch_threads = uint8(sConfigMgr->GetOption<int32>("WorldDatabase.SynchThreads", 1));
|
||||
///- Initialise the world database
|
||||
if (!WorldDatabase.Open(dbstring, async_threads, synch_threads))
|
||||
{
|
||||
@@ -422,14 +422,14 @@ bool Master::_StartDB()
|
||||
}
|
||||
|
||||
///- Get character database info from configuration file
|
||||
dbstring = sConfigMgr->GetStringDefault("CharacterDatabaseInfo", "");
|
||||
dbstring = sConfigMgr->GetOption<std::string>("CharacterDatabaseInfo", "");
|
||||
if (dbstring.empty())
|
||||
{
|
||||
sLog->outError("Character database not specified in configuration file");
|
||||
return false;
|
||||
}
|
||||
|
||||
async_threads = uint8(sConfigMgr->GetIntDefault("CharacterDatabase.WorkerThreads", 1));
|
||||
async_threads = uint8(sConfigMgr->GetOption<int32>("CharacterDatabase.WorkerThreads", 1));
|
||||
if (async_threads < 1 || async_threads > 32)
|
||||
{
|
||||
sLog->outError("Character database: invalid number of worker threads specified. "
|
||||
@@ -437,7 +437,7 @@ bool Master::_StartDB()
|
||||
return false;
|
||||
}
|
||||
|
||||
synch_threads = uint8(sConfigMgr->GetIntDefault("CharacterDatabase.SynchThreads", 2));
|
||||
synch_threads = uint8(sConfigMgr->GetOption<int32>("CharacterDatabase.SynchThreads", 2));
|
||||
|
||||
///- Initialise the Character database
|
||||
if (!CharacterDatabase.Open(dbstring, async_threads, synch_threads))
|
||||
@@ -447,14 +447,14 @@ bool Master::_StartDB()
|
||||
}
|
||||
|
||||
///- Get login database info from configuration file
|
||||
dbstring = sConfigMgr->GetStringDefault("LoginDatabaseInfo", "");
|
||||
dbstring = sConfigMgr->GetOption<std::string>("LoginDatabaseInfo", "");
|
||||
if (dbstring.empty())
|
||||
{
|
||||
sLog->outError("Login database not specified in configuration file");
|
||||
return false;
|
||||
}
|
||||
|
||||
async_threads = uint8(sConfigMgr->GetIntDefault("LoginDatabase.WorkerThreads", 1));
|
||||
async_threads = uint8(sConfigMgr->GetOption<int32>("LoginDatabase.WorkerThreads", 1));
|
||||
if (async_threads < 1 || async_threads > 32)
|
||||
{
|
||||
sLog->outError("Login database: invalid number of worker threads specified. "
|
||||
@@ -462,7 +462,7 @@ bool Master::_StartDB()
|
||||
return false;
|
||||
}
|
||||
|
||||
synch_threads = uint8(sConfigMgr->GetIntDefault("LoginDatabase.SynchThreads", 1));
|
||||
synch_threads = uint8(sConfigMgr->GetOption<int32>("LoginDatabase.SynchThreads", 1));
|
||||
///- Initialise the login database
|
||||
if (!LoginDatabase.Open(dbstring, async_threads, synch_threads))
|
||||
{
|
||||
@@ -471,7 +471,7 @@ bool Master::_StartDB()
|
||||
}
|
||||
|
||||
///- Get the realm Id from the configuration file
|
||||
realmID = sConfigMgr->GetIntDefault("RealmID", 0);
|
||||
realmID = sConfigMgr->GetOption<int32>("RealmID", 0);
|
||||
if (!realmID)
|
||||
{
|
||||
sLog->outError("Realm ID not defined in configuration file");
|
||||
|
||||
Reference in New Issue
Block a user