DarkflameServer/docker/setup.sh
David Markowitz bad3845d83
Address Docker issues and remove need to extract cdclient.fdb (#895)
* Implement a server res directory

* Only convert if neither exist

* Remove unzip, Update RegEx

* readme updates

Run setup after setting working dir

Address several docker issues

Revert "Run setup after setting working dir"

This reverts commit fd2fb9228e82a350204c1ef61f7ba059479bb12f.

Fix docker

* Remove extra submodules

* Rework logic

* Switch if block

* Remove need to extract fdb from client

* Change log name

* Update FdbToSqlite.cpp
2023-01-06 23:04:20 -06:00

43 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# fail on first error
set -e
function update_ini() {
FILE="/docker/configs/$1"
KEY=$2
NEW_VALUE=$3
sed -i "s~$2=.*~$2=$3~" $FILE
}
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
if [[ "$INI_FILE" != "worldconfig.ini" ]]; then
update_ini $INI_FILE external_ip $EXTERNAL_IP
fi
}
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/
cp resources/sharedconfig.ini /docker/configs/
# always use the internal docker hostname
update_ini masterconfig.ini master_ip "darkflame"
update_ini sharedconfig.ini client_location "/client"
update_database_ini_values_for sharedconfig.ini
}
update_ini_values