From 96fc8f4064a41632274fa5faa4102ab11fc1f027 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Wed, 3 Jul 2019 15:40:45 +0200
Subject: [PATCH] Load config from 'config.py'.
---
app/__init__.py | 9 ++++++++-
opaque.py | 3 ++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/app/__init__.py b/app/__init__.py
index 37ffe28b..5b5f3691 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -1,7 +1,14 @@
+from config import config
from flask import Flask
-def create_app():
+def create_app(config_name):
app = Flask(__name__)
+ app.config.from_object(config[config_name])
+ config[config_name].init_app(app)
+
+ @app.route('/')
+ def index():
+ return 'Opaque'
return app
diff --git a/opaque.py b/opaque.py
index 5ee9c43e..8a87447a 100644
--- a/opaque.py
+++ b/opaque.py
@@ -1,4 +1,5 @@
from app import create_app
+import os
-app = create_app
+app = create_app(os.getenv('FLASK_CONFIG') or 'default')