Skip to content
Snippets Groups Projects
Commit 5f5b094f authored by Rolf Niepraschk's avatar Rolf Niepraschk
Browse files

Parameterübergabe angepasst

parent 9c2f079c
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
# $1 = flask port
# $2 = data path
# $1 = flask port (required)
# $2 = data path (required)
# $3 = flask env (optional: development or production, default: development)
# $4 = flask debug (optional: 0 or 1, default: 1)
if [ $# -lt 2 ]; then
echo "error: missing parameter"
echo "error: at least two parameters are expected"
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
FLASK_RUN_PORT={$1}
DATA_PATH={$2}
FLASK_ENV=${3:-development}
FLASK_DEBUG=${4:-1}
python3 -m venv ./
source bin/activate
pip3 install -e .
python3 server.py "$2"
pip3 install -e ./
python3 server.py "$1" "$2" "$3" "$4"
......@@ -4,9 +4,12 @@ from flask_cors import CORS
from urllib.parse import urlparse
import sys, requests
app = Flask(__name__)
app = Flask(__name__)
DATA_PATH = sys.argv[1]
FLASK_RUN_PORT = sys.argv[1]
DATA_PATH = sys.argv[2]
FLASK_ENV = sys.argv[3]
FLASK_DEBUG = sys.argv[4]
COUCHDB_PROTO = 'http'
COUCHDB_PORT = '5984'
DB = 'vl_db'
......@@ -81,4 +84,6 @@ def couchdb_proxy(p=''):
return response
if __name__ == '__main__':
app.run(host='0.0.0.0')
app.config["ENV"] = FLASK_ENV
app.config["DEBUG"] = FLASK_DEBUG
app.run(host='0.0.0.0', port=FLASK_RUN_PORT)
......@@ -6,12 +6,15 @@ After=network.target
User=nobody
Environment=FLASK_PORT=8081
Environment=DATA_PATH=/srv/www/data/
Environment=FLASK_ENV=production
Environment=FLASK_DEBUG=1
Type=simple
StandardOutput=null
StandardError=null
Restart=no
WorkingDirectory=/usr/local/share/webapps-deliverer
ExecStart=/bin/bash -l -c "source bin/activate;./server ${FLASK_PORT} ${DATA_PATH}"
ExecStart=/bin/bash -l -c "source bin/activate;./server \
${FLASK_PORT} ${DATA_PATH} ${FLASK_ENV} ${FLASK_DEBUG}"
[Install]
WantedBy=multi-user.target
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