Update server config content

Also keep upper case variable names reserved for env variables and let the server create the control fifo itself.
This commit is contained in:
Gunter Labes 2024-02-21 00:40:08 +01:00 committed by GitHub
parent 8cebaf5b51
commit f567187dc7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,8 +10,8 @@ set -o nounset
run=""
[ "$1" = "-n" ] && { run=echo; shift; }
VERSION="$1"
PORT="$2"
version="$1"
port="$2"
prefix="$HOME/campaignd"
@ -19,7 +19,7 @@ if [ ! -d "$prefix" ]; then
die "FATAL: campaignd prefix \`$prefix\` missing!"
fi
instance="$prefix/$VERSION"
instance="$prefix/$version"
control_fifo="$instance/socket"
server_cfg="$instance/server.cfg"
@ -32,23 +32,21 @@ fi
$run mkdir "$instance"
$run mkdir "$instance/data"
$run mkdir "$instance/logs"
$run mknod "$control_fifo" p
$run ln -sf "../COPYING.txt" "$instance/COPYING.txt"
$run ln -sf "$instance/current.log" "$HOME/$VERSION.log"
$run ln -sf "$instance/current.log" "$HOME/$version.log"
# Create the initial configuration for a server in read-only mode.
$run cat > "$server_cfg" <<EOF
compress_level=9
control_socket="$control_fifo"
port=$PORT
port=$port
stats_exempt_ips="192.168.*,127.0.0.1"
read_only=yes
[server_info]
feedback_url_format="https://r.wesnoth.org/t\$topic_id"
id=$version
[/server_info]
[campaigns]
[/campaigns]
EOF
set +x
@ -56,7 +54,7 @@ set +x
if [ "$run" != "echo" ]; then
echo '************************************************************************'
echo "Instance created. To disable read-only mode for officially opening it "
echo "up to users, run \`send_campaignd_command $VERSION readonly no\` after "
echo "up to users, run \`send_campaignd_command $version readonly no\` after "
echo "starting it for the first time."
echo '************************************************************************'
fi