Configuration files are automatically generated based on env variables in the Docker image

This commit is contained in:
2024-06-02 21:45:51 +03:00
parent 6d65fae7e4
commit 170be95dc5
8 changed files with 104 additions and 15 deletions

View File

@ -126,9 +126,9 @@ void emptybeat(LPHEART heart, int pulse)
//
int Start()
{
if (!CConfig::instance().LoadFile("conf.txt"))
if (!CConfig::instance().LoadFile("db.conf"))
{
SPDLOG_ERROR("Loading conf.txt failed.");
SPDLOG_ERROR("Loading db.conf failed.");
return false;
}

View File

@ -292,7 +292,7 @@ void config_init(const string& st_localeServiceName)
string st_configFileName;
st_configFileName.reserve(32);
st_configFileName = "CONFIG";
st_configFileName = "game.conf";
if (!st_localeServiceName.empty())
{
@ -775,19 +775,27 @@ void config_init(const string& st_localeServiceName)
TOKEN("test_server")
{
printf("-----------------------------------------------\n");
printf("TEST_SERVER\n");
printf("-----------------------------------------------\n");
str_to_number(test_server, value_string);
if (test_server) {
printf("-----------------------------------------------\n");
printf("TEST_SERVER\n");
printf("-----------------------------------------------\n");
}
continue;
}
TOKEN("speed_server")
{
printf("-----------------------------------------------\n");
printf("SPEED_SERVER\n");
printf("-----------------------------------------------\n");
str_to_number(speed_server, value_string);
if (speed_server) {
printf("-----------------------------------------------\n");
printf("SPEED_SERVER\n");
printf("-----------------------------------------------\n");
}
continue;
}
#ifdef __AUCTION__
@ -887,7 +895,11 @@ void config_init(const string& st_localeServiceName)
two_arguments(value_string, szIP, sizeof(szIP), szPort, sizeof(szPort));
if (!*szIP || (!*szPort && strcasecmp(szIP, "master")))
// Skip if arguments are empty
if (!*szIP)
continue;
if (!*szPort && strcasecmp(szIP, "master"))
{
SPDLOG_CRITICAL("AUTH_SERVER: syntax error: <ip|master> <port>");
exit(EXIT_FAILURE);