diff --git a/server b/server
index 6afa075410cc9e5357b60362bc05b89af6639e0e..c624d374e204e8219f5087dc7a0ca2f9238c7b77 100755
--- a/server
+++ b/server
@@ -1,19 +1,22 @@
 #!/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"
diff --git a/server.py b/server.py
index b064536a94906f03b8080dfa4a855e959dce8430..097303744bda7c1a8b588ead81e6180d54611197 100644
--- a/server.py
+++ b/server.py
@@ -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)
diff --git a/webapps-deliverer.service b/webapps-deliverer.service
index bd09d3b68f8aa2bc4497d4d8838459989714b6d3..5bff782ce772bbc1e7b144752597a122b4f2013c 100644
--- a/webapps-deliverer.service
+++ b/webapps-deliverer.service
@@ -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