mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 15:07:28 +00:00
Implement a shared config between servers (#795)
* Implement a shared config between servers * Auto move config file on CMake run
This commit is contained in:
parent
d8e73def9d
commit
a745cdb727
@ -90,7 +90,7 @@ make_directory(${CMAKE_BINARY_DIR}/locale)
|
||||
make_directory(${CMAKE_BINARY_DIR}/logs)
|
||||
|
||||
# Copy resource files on first build
|
||||
set(RESOURCE_FILES "authconfig.ini" "chatconfig.ini" "worldconfig.ini" "masterconfig.ini" "blacklist.dcf")
|
||||
set(RESOURCE_FILES "sharedconfig.ini" "authconfig.ini" "chatconfig.ini" "worldconfig.ini" "masterconfig.ini" "blacklist.dcf")
|
||||
foreach(resource_file ${RESOURCE_FILES})
|
||||
if (NOT EXISTS ${PROJECT_BINARY_DIR}/${resource_file})
|
||||
configure_file(
|
||||
|
@ -209,7 +209,7 @@ Initial setup can vary drastically based on which operating system or distributi
|
||||
|
||||
#### Configuration
|
||||
|
||||
After the server has been built there should be four `ini` files in the build director: `authconfig.ini`, `chatconfig.ini`, `masterconfig.ini`, and `worldconfig.ini`. Go through them and fill in the database credentials and configure other settings if necessary.
|
||||
After the server has been built there should be four `ini` files in the build director: `sharedconfig.ini`, `authconfig.ini`, `chatconfig.ini`, `masterconfig.ini`, and `worldconfig.ini`. Go through them and fill in the database credentials and configure other settings if necessary.
|
||||
|
||||
#### Migrations
|
||||
|
||||
|
@ -12,6 +12,15 @@ dConfig::dConfig(const std::string& filepath) {
|
||||
if (line[0] != '#') ProcessLine(line);
|
||||
}
|
||||
}
|
||||
|
||||
std::ifstream sharedConfig("sharedconfig.ini", std::ios::in);
|
||||
if (!sharedConfig.good()) return;
|
||||
|
||||
while (std::getline(sharedConfig, line)) {
|
||||
if (line.length() > 0) {
|
||||
if (line[0] != '#') ProcessLine(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dConfig::~dConfig(void) {
|
||||
@ -40,6 +49,12 @@ void dConfig::ProcessLine(const std::string& line) {
|
||||
if (!seglist[1].empty() && seglist[1][seglist[1].size() - 1] == '\r')
|
||||
seglist[1].erase(seglist[1].size() - 1);
|
||||
|
||||
for (const auto& key : m_Keys) {
|
||||
if (seglist[0] == key) {
|
||||
return; // first loaded key is preferred due to loading shared config secondarily
|
||||
}
|
||||
}
|
||||
|
||||
m_Keys.push_back(seglist[0]);
|
||||
m_Values.push_back(seglist[1]);
|
||||
}
|
||||
|
@ -1,27 +1,6 @@
|
||||
# MySQL connection info:
|
||||
mysql_host=
|
||||
mysql_database=
|
||||
mysql_username=
|
||||
mysql_password=
|
||||
|
||||
# The public facing IP address. Can be 'localhost' for locally hosted servers
|
||||
external_ip=localhost
|
||||
|
||||
# Port number. The client has the authserver port hardcoded to 1001
|
||||
port=1001
|
||||
|
||||
# Where to put crashlogs
|
||||
dump_folder=
|
||||
|
||||
# How many clients can be connected to the server at once
|
||||
max_clients=999
|
||||
|
||||
# 0 or 1, should log to console
|
||||
log_to_console=1
|
||||
|
||||
# 0 or 1, should log debug (developer only) statements to console for debugging, not needed for normal operation
|
||||
log_debug_statements=0
|
||||
|
||||
# 0 or 1, should ignore playkeys
|
||||
# If 1 everyone with an account will be able to login, regardless of if they have a key or not
|
||||
dont_use_keys=0
|
||||
|
@ -1,26 +1,2 @@
|
||||
# MySQL connection info:
|
||||
mysql_host=
|
||||
mysql_database=
|
||||
mysql_username=
|
||||
mysql_password=
|
||||
|
||||
# The public facing IP address. Can be 'localhost' for locally hosted servers
|
||||
external_ip=localhost
|
||||
|
||||
# Port number
|
||||
port=2005
|
||||
|
||||
# Where to put crashlogs
|
||||
dump_folder=
|
||||
|
||||
# How many clients can be connected to the server at once
|
||||
max_clients=999
|
||||
|
||||
# 0 or 1, should log to console
|
||||
log_to_console=1
|
||||
|
||||
# 0 or 1, should log debug (developer only) statements to console for debugging, not needed for normal operation
|
||||
log_debug_statements=0
|
||||
|
||||
# 0 or 1, should not compile chat hash map to file
|
||||
dont_generate_dcf=0
|
||||
|
@ -1,12 +1,3 @@
|
||||
# MySQL connection info:
|
||||
mysql_host=
|
||||
mysql_database=
|
||||
mysql_username=
|
||||
mysql_password=
|
||||
|
||||
# The public facing IP address. Can be 'localhost' for locally hosted servers
|
||||
external_ip=localhost
|
||||
|
||||
# The internal ip of the master server
|
||||
master_ip=localhost
|
||||
|
||||
@ -26,17 +17,5 @@ use_sudo_chat=0
|
||||
# Use sudo when launching world servers
|
||||
use_sudo_world=0
|
||||
|
||||
# Where to put crashlogs
|
||||
dump_folder=
|
||||
|
||||
# How many clients can be connected to the server at once
|
||||
max_clients=999
|
||||
|
||||
# 0 or 1, should log to console
|
||||
log_to_console=1
|
||||
|
||||
# 0 or 1, should log debug (developer only) statements to console for debugging, not needed for normal operation
|
||||
log_debug_statements=0
|
||||
|
||||
# 0 or 1, should autostart auth, chat, and char servers
|
||||
prestart_servers=1
|
||||
|
23
resources/sharedconfig.ini
Normal file
23
resources/sharedconfig.ini
Normal file
@ -0,0 +1,23 @@
|
||||
# MySQL connection info:
|
||||
mysql_host=
|
||||
mysql_database=
|
||||
mysql_username=
|
||||
mysql_password=
|
||||
|
||||
# 0 or 1, should log to console
|
||||
log_to_console=1
|
||||
|
||||
# 0 or 1, should log debug (developer only) statements to console for debugging, not needed for normal operation
|
||||
log_debug_statements=0
|
||||
|
||||
# The public facing IP address. Can be 'localhost' for locally hosted servers
|
||||
external_ip=localhost
|
||||
|
||||
# 0 or 1, should not compile chat hash map to file
|
||||
dont_generate_dcf=0
|
||||
|
||||
# How many clients can be connected to the server at once
|
||||
max_clients=999
|
||||
|
||||
# Where to put crashlogs
|
||||
dump_folder=
|
@ -1,9 +1,3 @@
|
||||
# MySQL connection info:
|
||||
mysql_host=
|
||||
mysql_database=
|
||||
mysql_username=
|
||||
mysql_password=
|
||||
|
||||
# URL to the code repository for the hosted server
|
||||
# If you fork this repository and/or make changes to the code, reflect that here to comply with AGPLv3
|
||||
source=https://github.com/DarkflameUniverse/DarkflameServer
|
||||
@ -11,21 +5,6 @@ source=https://github.com/DarkflameUniverse/DarkflameServer
|
||||
# Port to the chat server, same as in chatconfig.ini
|
||||
chat_server_port=2005
|
||||
|
||||
# Where to put crashlogs
|
||||
dump_folder=
|
||||
|
||||
# How many clients can be connected to the server at once
|
||||
max_clients=999
|
||||
|
||||
# 0 or 1, should log to console
|
||||
log_to_console=1
|
||||
|
||||
# 0 or 1, should log debug (developer only) statements to console for debugging, not needed for normal operation
|
||||
log_debug_statements=0
|
||||
|
||||
# 0 or 1, should not compile chat hash map to file
|
||||
dont_generate_dcf=0
|
||||
|
||||
# 0 or 1, should disable chat
|
||||
disable_chat=0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user