Improve magic startup script

This commit is contained in:
Kristóf Tóth 2018-03-03 21:59:34 +01:00
parent 8a80797d14
commit cbf2caa4c3

View File

@ -1,6 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
[ -z $TAO_PATH ] && echo 'You need to set the "TAO_PATH" envvar to the directory where the TFW repos are cloned!' && exit 1
BACKEND_REPO="${BACKEND_REPO:-tutorial-framework-wip}" BACKEND_REPO="${BACKEND_REPO:-tutorial-framework-wip}"
FRONTEND_REPO="${FRONTEND_REPO:-tutorial-framework-ng}" FRONTEND_REPO="${FRONTEND_REPO:-tutorial-framework-ng}"
BACKEND_PATH="${TAO_PATH}/${BACKEND_REPO}" BACKEND_PATH="${TAO_PATH}/${BACKEND_REPO}"
@ -23,6 +25,7 @@ function run_backend()
docker run --rm -p $BACKEND_PORT:$BACKEND_PORT -e AVATAO_SECRET=$AVATAO_SECRET $IMAGE_NAME docker run --rm -p $BACKEND_PORT:$BACKEND_PORT -e AVATAO_SECRET=$AVATAO_SECRET $IMAGE_NAME
} }
trap 'kill %1; kill %2' SIGINT trap 'exit' INT TERM
trap 'kill 0' EXIT
run_frontend & run_backend run_frontend & run_backend
wait