Add docker run script to change api url on startup

This commit is contained in:
kolaente 2020-05-05 23:31:01 +02:00
parent 38c7e4b3c2
commit 9fdbcd56cf
Signed by untrusted user who does not match committer: konrad
GPG key ID: F40E70337AB24C9B
2 changed files with 19 additions and 4 deletions

14
run.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
# This shell script sets the api url based on an environment variable and starts nginx in foreground.
if [ -z "$VIKUNJA_API_URL" ]; then
VIKUNJA_API_URL="/api/v1"
fi
# Escape the variable to prevent sed from complaining
VIKUNJA_API_URL=$(echo $VIKUNJA_API_URL |sed 's/\//\\\//g')
sed -i "s/http\:\/\/localhost\:3456\/api\/v1/$VIKUNJA_API_URL/g" /usr/share/nginx/html/index.html
nginx -g "daemon off;"