diff --git a/entrypoint/site-config.sh b/entrypoint/site-config.sh index 89fb108..ec70b52 100644 --- a/entrypoint/site-config.sh +++ b/entrypoint/site-config.sh @@ -1,7 +1,9 @@ #!/bin/bash # load default values +set -a . /opt/entrypoint/defaults.sh +set +a # load some functions . /opt/entrypoint/utils.sh @@ -10,6 +12,20 @@ NGINX_PREFIX="/etc/nginx/" if [ "$MULTISITE" = "yes" ] ; then NGINX_PREFIX="${NGINX_PREFIX}${1}/" + if [ ! -d "$NGINX_PREFIX" ] ; then + mkdir "$NGINX_PREFIX" + fi + ROOT_FOLDER="${ROOT_FOLDER}/$1" +fi +env | grep -E -v "^(HOSTNAME|PWD|PKG_RELEASE|NJS_VERSION|SHLVL|PATH|_|NGINX_VERSION)=" > "${NGINX_PREFIX}nginx.env" + +if [ "$MULTISITE" = "yes" ] ; then + sed -i "s~^SERVER_NAME=.*~SERVER_NAME=$1~" "${NGINX_PREFIX}nginx.env" + for server in $SERVER_NAME ; do + if [ "$server" != "$1" ] ; then + sed -i "/^${server}_.*=.*/d" "${NGINX_PREFIX}nginx.env" + fi + done for var in $(env) ; do name=$(echo "$var" | cut -d '=' -f 1) check=$(echo "$name" | grep "^$1_") @@ -17,15 +33,14 @@ if [ "$MULTISITE" = "yes" ] ; then repl_name=$(echo "$name" | sed "s~${1}_~~") repl_value=$(echo "$var" | sed "s~${name}=~~") read -r "$repl_name" <<< $repl_value + sed -i "/^${repl_name}=.*/d" "${NGINX_PREFIX}nginx.env" + sed -i "/^${name}=.*/d" "${NGINX_PREFIX}nginx.env" + echo "${repl_name}=${repl_value}" >> "${NGINX_PREFIX}nginx.env" fi done - ROOT_FOLDER="${ROOT_FOLDER}/$1" fi # copy stub confs -if [ "$MULTISITE" = "yes" ] ; then - mkdir "$NGINX_PREFIX" -fi cp /opt/confs/site/* "$NGINX_PREFIX" # replace paths diff --git a/ui/entrypoint.py b/ui/entrypoint.py index b964eca..4fa6d04 100644 --- a/ui/entrypoint.py +++ b/ui/entrypoint.py @@ -33,6 +33,7 @@ def instances(): @app.route('/services') def services(): check, services = wrappers.get_services() + print(services, flush=True) if not check : return render_template("error.html", title="Error", error=services) return render_template("services.html", title="Services", services=services) diff --git a/ui/templates/instances.html b/ui/templates/instances.html index 2d2fccc..87893ae 100644 --- a/ui/templates/instances.html +++ b/ui/templates/instances.html @@ -2,9 +2,9 @@ {% block content %} -