mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-15 12:58:22 +00:00
Update loginserver commands to use the new and more proper argument format
This commit is contained in:
+54
-30
@@ -43,22 +43,28 @@ void CatchSignal(int sig_num)
|
||||
{
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
void LoadDatabaseConnection()
|
||||
{
|
||||
RegisterExecutablePlatform(ExePlatformLogin);
|
||||
set_exception_handler();
|
||||
LogInfo("MySQL Database Init");
|
||||
|
||||
LogInfo("Logging System Init");
|
||||
server.db = new Database(
|
||||
server.config.GetVariableString("database", "user", "root"),
|
||||
server.config.GetVariableString("database", "password", ""),
|
||||
server.config.GetVariableString("database", "host", "localhost"),
|
||||
server.config.GetVariableString("database", "port", "3306"),
|
||||
server.config.GetVariableString("database", "db", "peq")
|
||||
);
|
||||
|
||||
if (argc == 1) {
|
||||
LogSys.LoadLogSettingsDefaults();
|
||||
}
|
||||
}
|
||||
|
||||
void LoadServerConfig()
|
||||
{
|
||||
server.config = EQ::JsonConfigFile::Load("login.json");
|
||||
LogInfo("Config System Init");
|
||||
|
||||
|
||||
/**
|
||||
* options: logging
|
||||
* Logging
|
||||
*/
|
||||
server.options.Trace(server.config.GetVariableBool("logging", "trace", false));
|
||||
server.options.WorldTrace(server.config.GetVariableBool("logging", "world_trace", false));
|
||||
@@ -66,7 +72,7 @@ int main(int argc, char **argv)
|
||||
server.options.DumpOutPackets(server.config.GetVariableBool("logging", "dump_packets_out", false));
|
||||
|
||||
/**
|
||||
* options: worldservers
|
||||
* Worldservers
|
||||
*/
|
||||
server.options.RejectDuplicateServers(
|
||||
server.config.GetVariableBool(
|
||||
@@ -77,7 +83,7 @@ int main(int argc, char **argv)
|
||||
server.options.AllowUnregistered(server.config.GetVariableBool("worldservers", "unregistered_allowed", true));
|
||||
|
||||
/**
|
||||
* options: account
|
||||
* Account
|
||||
*/
|
||||
server.options.AutoCreateAccounts(server.config.GetVariableBool("account", "auto_create_accounts", true));
|
||||
server.options.AutoLinkAccounts(server.config.GetVariableBool("account", "auto_link_accounts", false));
|
||||
@@ -92,6 +98,9 @@ int main(int argc, char **argv)
|
||||
);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Default Loginserver Name (Don't change)
|
||||
*/
|
||||
server.options.DefaultLoginServerName(
|
||||
server.config.GetVariableString(
|
||||
"general",
|
||||
@@ -100,6 +109,10 @@ int main(int argc, char **argv)
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Security
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_SECURITY
|
||||
server.options.EncryptionMode(server.config.GetVariableInt("security", "mode", 13));
|
||||
#else
|
||||
@@ -115,19 +128,41 @@ int main(int argc, char **argv)
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
RegisterExecutablePlatform(ExePlatformLogin);
|
||||
set_exception_handler();
|
||||
|
||||
LogInfo("Logging System Init");
|
||||
|
||||
if (argc == 1) {
|
||||
LogSys.LoadLogSettingsDefaults();
|
||||
}
|
||||
|
||||
/**
|
||||
* Command handler
|
||||
*/
|
||||
if (argc > 1) {
|
||||
LogSys.SilenceConsoleLogging();
|
||||
|
||||
LoadServerConfig();
|
||||
LoadDatabaseConnection();
|
||||
|
||||
LogSys.LoadLogSettingsDefaults();
|
||||
LogSys.log_settings[Logs::Debug].log_to_console = static_cast<uint8>(Logs::General);
|
||||
LogSys.log_settings[Logs::Debug].is_category_enabled = 1;
|
||||
|
||||
LoginserverCommandHandler::CommandHandler(argc, argv);
|
||||
}
|
||||
|
||||
LoadServerConfig();
|
||||
|
||||
/**
|
||||
* mysql connect
|
||||
*/
|
||||
LogInfo("MySQL Database Init");
|
||||
|
||||
server.db = new Database(
|
||||
server.config.GetVariableString("database", "user", "root"),
|
||||
server.config.GetVariableString("database", "password", ""),
|
||||
server.config.GetVariableString("database", "host", "localhost"),
|
||||
server.config.GetVariableString("database", "port", "3306"),
|
||||
server.config.GetVariableString("database", "db", "peq")
|
||||
);
|
||||
LoadDatabaseConnection();
|
||||
|
||||
if (argc == 1) {
|
||||
server.db->LoadLogSettings(LogSys.log_settings);
|
||||
@@ -195,17 +230,6 @@ int main(int argc, char **argv)
|
||||
LoginserverWebserver::RegisterRoutes(api);
|
||||
}
|
||||
|
||||
/**
|
||||
* Command handler
|
||||
*/
|
||||
if (argc > 1) {
|
||||
LogSys.LoadLogSettingsDefaults();
|
||||
LogSys.log_settings[Logs::Debug].log_to_console = static_cast<uint8>(Logs::General);
|
||||
LogSys.log_settings[Logs::Debug].is_category_enabled = 1;
|
||||
|
||||
LoginserverCommandHandler::CommandHandler(argc, argv);
|
||||
}
|
||||
|
||||
LogInfo("[Config] [Logging] IsTraceOn [{0}]", server.options.IsTraceOn());
|
||||
LogInfo("[Config] [Logging] IsWorldTraceOn [{0}]", server.options.IsWorldTraceOn());
|
||||
LogInfo("[Config] [Logging] IsDumpInPacketsOn [{0}]", server.options.IsDumpInPacketsOn());
|
||||
|
||||
Reference in New Issue
Block a user