Skip to content
Snippets Groups Projects
Commit a73501e5 authored by Lars Kruse's avatar Lars Kruse Committed by David Trattnig
Browse files

refactor(run.sh): unify calling of python

* `/usr/bin/env` is not necessary: `python3` is just the same
  (`/usr/bin/env python3` is helpful in a shebang, since an absolute
  path is required there)
* use the variable `$PYTHON_EXEC`: it was introduced recently, but not
  used for now
parent 3612eb3f
No related branches found
No related tags found
1 merge request!1Style & Tests
...@@ -34,7 +34,7 @@ echo "[ Docker=$docker ]" ...@@ -34,7 +34,7 @@ echo "[ Docker=$docker ]"
# Check for the correct Python version (3.8+) # Check for the correct Python version (3.8+)
PYTHON_EXEC="python3" PYTHON_EXEC="python3"
echo "[ Using $(python3 -V) ]" echo "[ Using $("$PYTHON_EXEC" -V) ]"
# +++ DEFAULT COMMANDS +++ # # +++ DEFAULT COMMANDS +++ #
...@@ -45,24 +45,24 @@ if [[ $docker == "false" ]]; then ...@@ -45,24 +45,24 @@ if [[ $docker == "false" ]]; then
if [[ $mode == "dev" ]]; then if [[ $mode == "dev" ]]; then
source python/bin/activate source python/bin/activate
echo "Running Engine API in Python Environment ($(python3 -V))" echo "Running Engine API in Python Environment ($("$PYTHON_EXEC" -V))"
echo "Starting API Server" echo "Starting API Server"
python src/app.py "$PYTHON_EXEC" src/app.py
fi fi
### Runs the API Server (Test) ### ### Runs the API Server (Test) ###
if [[ $mode == "api-test-0" ]]; then if [[ $mode == "api-test-0" ]]; then
echo "Starting API Server 0" echo "Starting API Server 0"
/usr/bin/env python3 src/app.py config=tests/config/engine-0-api.ini "$PYTHON_EXEC" src/app.py config=tests/config/engine-0-api.ini
fi fi
if [[ $mode == "api-test-1" ]]; then if [[ $mode == "api-test-1" ]]; then
echo "Starting API Server 1" echo "Starting API Server 1"
/usr/bin/env python3 src/app.py config=tests/config/engine-1-api.ini "$PYTHON_EXEC" src/app.py config=tests/config/engine-1-api.ini
fi fi
if [[ $mode == "api-test-2" ]]; then if [[ $mode == "api-test-2" ]]; then
echo "Starting API Server 2" echo "Starting API Server 2"
/usr/bin/env python3 src/app.py config=tests/config/engine-2-api.ini "$PYTHON_EXEC" src/app.py config=tests/config/engine-2-api.ini
fi fi
### Runs the API Server using Gunicorn without a system daemon (Production) ### ### Runs the API Server using Gunicorn without a system daemon (Production) ###
...@@ -80,7 +80,7 @@ if [[ $docker == "false" ]]; then ...@@ -80,7 +80,7 @@ if [[ $docker == "false" ]]; then
### CAUTION: This deletes everything in your database ### ### CAUTION: This deletes everything in your database ###
if [[ $mode == "recreate-database" ]]; then if [[ $mode == "recreate-database" ]]; then
/usr/bin/env python3 src/app.py --recreate-database "$PYTHON_EXEC" src/app.py --recreate-database
fi fi
fi fi
...@@ -117,4 +117,4 @@ if [[ $docker == "true" ]]; then ...@@ -117,4 +117,4 @@ if [[ $docker == "true" ]]; then
if [[ $mode == "push" ]]; then if [[ $mode == "push" ]]; then
exec sudo docker push autoradio/engine-api exec sudo docker push autoradio/engine-api
fi fi
fi fi
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment