diff --git a/server b/server index 2388f2b7772c286e351500a3e52c2064c9727020..6afa075410cc9e5357b60362bc05b89af6639e0e 100755 --- a/server +++ b/server @@ -1,10 +1,14 @@ #!/bin/bash -if [ -z "$1" ]; then - echo "error: missing data path" +# $1 = flask port +# $2 = data path + +if [ $# -lt 2 ]; then + echo "error: missing parameter" exit -1 fi +export FLASK_RUN_PORT="$1" export FLASK_APP=server.py export FLASK_DEBUG=1 export FLASK_ENV=development # TODO: FLASK_ENV=production @@ -12,4 +16,4 @@ export FLASK_ENV=development # TODO: FLASK_ENV=production python3 -m venv ./ source bin/activate pip3 install -e . -python3 server.py "$1" +python3 server.py "$2" diff --git a/webapps-deliverer.service b/webapps-deliverer.service index 96b31450e6c0521dc4b5da369a390fcd4c183ee2..bd09d3b68f8aa2bc4497d4d8838459989714b6d3 100644 --- a/webapps-deliverer.service +++ b/webapps-deliverer.service @@ -4,13 +4,14 @@ After=network.target [Service] User=nobody +Environment=FLASK_PORT=8081 Environment=DATA_PATH=/srv/www/data/ Type=simple StandardOutput=null StandardError=null Restart=no WorkingDirectory=/usr/local/share/webapps-deliverer -ExecStart=/bin/bash -l -c "source bin/activate;./server ${DATA_PATH}" +ExecStart=/bin/bash -l -c "source bin/activate;./server ${FLASK_PORT} ${DATA_PATH}" [Install] WantedBy=multi-user.target