feat(issue22/server-flask): Uses python-dotenv to avoid source manually env vars

This commit is contained in:
sovanna 2020-04-14 13:47:18 +09:00
parent e39a6cf6b0
commit 89181fbf82
2 changed files with 4 additions and 6 deletions

View File

@ -1,11 +1,8 @@
from os import environ
from dotenv import load_dotenv
from os import getenv
def getenv(env, default=None):
envar = environ.get(env, default)
if envar is None:
raise ValueError('envvar %s is missing' % env)
return envar
load_dotenv()
DEBUG = True if getenv('FLASK_DEBUG') == 'True' else False

View File

@ -6,5 +6,6 @@ Flask-Mail==0.9.1
itsdangerous==1.1.0
Jinja2==2.11.1
MarkupSafe==1.1.1
python-dotenv==0.12.0
six==1.14.0
Werkzeug==1.0.1