2021-12-08 07:50:15 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-01-05 16:21:11 +00:00
|
|
|
# fail on first error
|
|
|
|
set -e
|
|
|
|
|
2021-12-08 07:50:15 +00:00
|
|
|
function update_ini() {
|
|
|
|
FILE="/docker/configs/$1"
|
|
|
|
KEY=$2
|
|
|
|
NEW_VALUE=$3
|
2023-01-07 05:04:20 +00:00
|
|
|
sed -i "s~$2=.*~$2=$3~" $FILE
|
2021-12-08 07:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function update_database_ini_values_for() {
|
|
|
|
INI_FILE=$1
|
|
|
|
|
|
|
|
update_ini $INI_FILE mysql_host $DATABASE_HOST
|
|
|
|
update_ini $INI_FILE mysql_database $DATABASE
|
|
|
|
update_ini $INI_FILE mysql_username $DATABASE_USER
|
|
|
|
update_ini $INI_FILE mysql_password $DATABASE_PASSWORD
|
2023-08-04 02:38:33 +00:00
|
|
|
update_ini $INI_FILE client_net_version $BUILD_VERSION
|
|
|
|
update_ini $INI_FILE external_ip $EXTERNAL_IP
|
2021-12-08 07:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function update_ini_values() {
|
|
|
|
echo "Copying and updating config files"
|
|
|
|
|
|
|
|
mkdir -p /docker/configs
|
|
|
|
cp resources/masterconfig.ini /docker/configs/
|
|
|
|
cp resources/authconfig.ini /docker/configs/
|
|
|
|
cp resources/chatconfig.ini /docker/configs/
|
|
|
|
cp resources/worldconfig.ini /docker/configs/
|
2022-11-07 23:04:20 +00:00
|
|
|
cp resources/sharedconfig.ini /docker/configs/
|
2021-12-08 07:50:15 +00:00
|
|
|
|
2021-12-08 13:57:16 +00:00
|
|
|
# always use the internal docker hostname
|
|
|
|
update_ini masterconfig.ini master_ip "darkflame"
|
2023-01-07 05:04:20 +00:00
|
|
|
update_ini sharedconfig.ini client_location "/client"
|
2021-12-08 13:57:16 +00:00
|
|
|
|
2022-11-07 23:04:20 +00:00
|
|
|
update_database_ini_values_for sharedconfig.ini
|
2021-12-08 07:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
update_ini_values
|