From 52971ed42eefc77d5e3b9c028d6601985e25b180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=B6hlmann?= Date: Wed, 21 Aug 2019 16:34:25 +0300 Subject: [PATCH] Use os.environment.get() --- core/admin/start.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/admin/start.py b/core/admin/start.py index e8de9f77..d8165ff3 100755 --- a/core/admin/start.py +++ b/core/admin/start.py @@ -5,11 +5,12 @@ import os os.system("flask mailu advertise") os.system("flask db upgrade") -if 'INITIAL_ADMIN_ACCOUNT' in os.environ and 'INITIAL_ADMIN_DOMAIN' in os.environ and 'INITIAL_ADMIN_PW' in os.environ: - mode = 'ifmissing' - if 'INITIAL_ADMIN_MODE' in os.environ: - mode = os.environ['INITIAL_ADMIN_MODE'] - os.system("flask mailu admin %s %s '%s' --mode %s" % ( - os.environ['INITIAL_ADMIN_ACCOUNT'], os.environ['INITIAL_ADMIN_DOMAIN'], os.environ['INITIAL_ADMIN_PW'], mode)) +account = os.environ.get("INITIAL_ADMIN_ACCOUNT") +domain = os.environ.get("INITIAL_ADMIN_DOMAIN") +password = os.environ.get("INITIAL_ADMIN_PW") + +if account is not None and domain is not None and password is not None: + mode = os.environ.get("INITIAL_ADMIN_MODE", default="ifmissing") + os.system("flask mailu admin %s %s '%s' --mode %s" % (account, domain, password, mode)) os.system("gunicorn -w 4 -b :80 --access-logfile - --error-logfile - --preload 'mailu:create_app()'")