mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 21:26:23 +00:00
feat(Core/Config): rework config and delete ACE inherited (#4608)
This commit is contained in:
@@ -32,11 +32,6 @@ GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_executable(worldserver
|
||||
${PRIVATE_SOURCES})
|
||||
|
||||
if(NOT WIN32)
|
||||
set_target_properties(worldserver PROPERTIES
|
||||
COMPILE_DEFINITIONS _ACORE_CORE_CONFIG="${CONF_DIR}/worldserver.conf")
|
||||
endif()
|
||||
|
||||
add_dependencies(worldserver revision.h)
|
||||
|
||||
if(UNIX AND NOT NOJEM)
|
||||
@@ -73,19 +68,9 @@ set_target_properties(worldserver
|
||||
FOLDER
|
||||
"server")
|
||||
|
||||
if( WIN32 )
|
||||
if ( MSVC )
|
||||
add_custom_command(TARGET worldserver
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/worldserver.conf.dist ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/
|
||||
)
|
||||
elseif ( MINGW )
|
||||
add_custom_command(TARGET worldserver
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/worldserver.conf.dist ${CMAKE_BINARY_DIR}/bin/
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
# Install config
|
||||
CopyDefaultConfig(worldserver)
|
||||
CollectModulesConfig()
|
||||
|
||||
if( UNIX )
|
||||
install(TARGETS worldserver DESTINATION bin)
|
||||
@@ -93,38 +78,9 @@ elseif( WIN32 )
|
||||
install(TARGETS worldserver DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
|
||||
install(FILES worldserver.conf.dist DESTINATION ${CONF_DIR})
|
||||
|
||||
# Generate precompiled header
|
||||
if( USE_COREPCH )
|
||||
add_cxx_pch(worldserver ${PRIVATE_PCH_HEADER})
|
||||
endif()
|
||||
|
||||
# handle config file
|
||||
CU_GET_GLOBAL("MODULE_CONFIG_FILE_LIST")
|
||||
FOREACH(configFile ${MODULE_CONFIG_FILE_LIST})
|
||||
if( WIN32 )
|
||||
if ( MSVC )
|
||||
add_custom_command(TARGET worldserver
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${configFile}" ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/
|
||||
)
|
||||
elseif ( MINGW )
|
||||
add_custom_command(TARGET worldserver
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${configFile}" ${CMAKE_BINARY_DIR}/bin/
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
install(FILES "${configFile}" DESTINATION ${CONF_DIR})
|
||||
ENDFOREACH()
|
||||
|
||||
CU_GET_GLOBAL("MODULE_CONFIG_FILE_LIST")
|
||||
FOREACH(configFile ${MODULE_CONFIG_FILE_LIST})
|
||||
get_filename_component(file_name ${configFile} NAME_WE)
|
||||
set(CONFIG_LIST ${CONFIG_LIST}${file_name},)
|
||||
ENDFOREACH()
|
||||
add_definitions(-DCONFIG_FILE_LIST=$<1:"${CONFIG_LIST}">)
|
||||
# end handle config file
|
||||
|
||||
CU_RUN_HOOK("AFTER_WORLDSERVER_CMAKE")
|
||||
|
||||
@@ -126,7 +126,7 @@ void CliRunnable::run()
|
||||
rl_event_hook = cli_hook_func;
|
||||
#endif
|
||||
|
||||
if (sConfigMgr->GetBoolDefault("BeepAtStart", true))
|
||||
if (sConfigMgr->GetOption<bool>("BeepAtStart", true))
|
||||
printf("\a"); // \a = Alert
|
||||
|
||||
// print this here the first time
|
||||
|
||||
@@ -59,7 +59,7 @@ void usage(const char* prog)
|
||||
extern int main(int argc, char** argv)
|
||||
{
|
||||
///- Command line parsing to get the configuration file name
|
||||
char const* configFile = _ACORE_CORE_CONFIG;
|
||||
std::string configFile = sConfigMgr->GetConfigPath() + std::string(_ACORE_CORE_CONFIG);
|
||||
int c = 1;
|
||||
while (c < argc)
|
||||
{
|
||||
@@ -116,12 +116,13 @@ extern int main(int argc, char** argv)
|
||||
++c;
|
||||
}
|
||||
|
||||
sConfigMgr->SetConfigList(std::string(configFile), std::string(CONFIG_FILE_LIST));
|
||||
// Add file and args in config
|
||||
sConfigMgr->Configure(configFile, std::vector<std::string>(argv, argv + argc), CONFIG_FILE_LIST);
|
||||
|
||||
if (!sConfigMgr->LoadAppConfigs())
|
||||
return 1;
|
||||
|
||||
sLog->outString("Using configuration file %s.", configFile);
|
||||
sLog->outString("Using configuration file %s.", configFile.c_str());
|
||||
sLog->outString("Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
|
||||
sLog->outString("Using ACE version: %s", ACE_VERSION);
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -43,13 +43,13 @@ RARunnable::~RARunnable()
|
||||
|
||||
void RARunnable::run()
|
||||
{
|
||||
if (!sConfigMgr->GetBoolDefault("Ra.Enable", false))
|
||||
if (!sConfigMgr->GetOption<bool>("Ra.Enable", false))
|
||||
return;
|
||||
|
||||
ACE_Acceptor<RASocket, ACE_SOCK_ACCEPTOR> acceptor;
|
||||
|
||||
uint16 raPort = uint16(sConfigMgr->GetIntDefault("Ra.Port", 3443));
|
||||
std::string stringIp = sConfigMgr->GetStringDefault("Ra.IP", "0.0.0.0");
|
||||
uint16 raPort = uint16(sConfigMgr->GetOption<int32>("Ra.Port", 3443));
|
||||
std::string stringIp = sConfigMgr->GetOption<std::string>("Ra.IP", "0.0.0.0");
|
||||
ACE_INET_Addr listenAddress(raPort, stringIp.c_str());
|
||||
|
||||
if (acceptor.open(listenAddress, m_Reactor) == -1)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
RASocket::RASocket()
|
||||
{
|
||||
_minLevel = uint8(sConfigMgr->GetIntDefault("RA.MinLevel", 3));
|
||||
_minLevel = uint8(sConfigMgr->GetOption<int32>("RA.MinLevel", 3));
|
||||
_commandExecuting = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1967,7 +1967,6 @@ NpcEvadeIfTargetIsUnreachable = 5
|
||||
|
||||
NpcRegenHPIfTargetIsUnreachable = 1
|
||||
|
||||
|
||||
# NpcRegenHPTimeIfTargetIsUnreachable
|
||||
# Description: Specifies the time (in seconds) that a creature whom target
|
||||
# is unreachable in raid to end up regenerate health.
|
||||
@@ -2768,16 +2767,16 @@ Battleground.QueueAnnouncer.PlayerOnly = 0
|
||||
# Default: 300000 - (Enabled, 5 minutes)
|
||||
# 0 - (Disabled, Not recommended)
|
||||
|
||||
BattleGround.PrematureFinishTimer = 300000
|
||||
Battleground.PrematureFinishTimer = 300000
|
||||
|
||||
#
|
||||
# BattleGround.PremadeGroupWaitForMatch
|
||||
# Battleground.PremadeGroupWaitForMatch
|
||||
# Description: Time (in milliseconds) a pre-made group has to wait for matching group of the
|
||||
# other faction.
|
||||
# Default: 1800000 - (Enabled, 30 minutes)
|
||||
# 0 - (Disabled, Not recommended)
|
||||
|
||||
BattleGround.PremadeGroupWaitForMatch = 1800000
|
||||
Battleground.PremadeGroupWaitForMatch = 1800000
|
||||
|
||||
#
|
||||
# Battleground.GiveXPForKills
|
||||
|
||||
Reference in New Issue
Block a user