aboutsummaryrefslogtreecommitdiff
path: root/gn_auth
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-11-02 17:05:34 +0300
committerFrederick Muriuki Muriithi2023-11-02 17:05:34 +0300
commit195c07df02a065820ca24d17d455b71851f6c854 (patch)
tree31ee946e4835c52bcedcab938328663f2ef25d32 /gn_auth
parentc5d4a6f8104af1eaa0c9dfd8ea7025a673de731e (diff)
downloadgn-auth-195c07df02a065820ca24d17d455b71851f6c854.tar.gz
Config: Use instance_path to load secrets.
Diffstat (limited to 'gn_auth')
-rw-r--r--gn_auth/__init__.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/gn_auth/__init__.py b/gn_auth/__init__.py
index 6df1bc7..8bd0093 100644
--- a/gn_auth/__init__.py
+++ b/gn_auth/__init__.py
@@ -53,7 +53,10 @@ def setup_logging_handlers(app: Flask) -> None:
def create_app(config: Optional[dict] = None) -> Flask:
"""Create and return a new flask application."""
- app = Flask(__name__)
+ app_instance_path = os.environ.get("GN_AUTH_INSTANCE_PATH")
+ app = Flask(__name__,
+ instance_path=app_instance_path,
+ instance_relative_config=True)
# ====== Setup configuration ======
app.config.from_object(settings) # Default settings
@@ -64,6 +67,8 @@ def create_app(config: Optional[dict] = None) -> Flask:
app.config.from_envvar("GN_AUTH_CONF")
override_settings_with_envvars(app)
+ if bool(app_instance_path):## load secrets
+ app.config.from_pyfile("secrets.py")
# ====== END: Setup configuration ======
check_mandatory_settings(app)