From abe3c8b1b01d2b9fe6a33503ea54580753ae65f3 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 5 Mar 2024 06:45:19 +0300 Subject: Pick secrets from config file. --- gn2/wqflask/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gn2') diff --git a/gn2/wqflask/__init__.py b/gn2/wqflask/__init__.py index 8cc2904c..8e96228d 100644 --- a/gn2/wqflask/__init__.py +++ b/gn2/wqflask/__init__.py @@ -70,9 +70,9 @@ app.jinja_env.globals.update( app.config["SESSION_REDIS"] = redis.from_url(app.config["REDIS_URL"]) ## BEGIN: SECRETS -- Should be the last of the settings to load -secrets_file = os.environ.get("GN2_SECRETS") -if secrets_file and Path(secrets_file).exists(): - app.config.from_envvar("GN2_SECRETS") +secrets_file = Path(app.config.get("GN2_SECRETS", "")).absolute() +if secrets_file.exists() and secrets_file.is_file(): + app.config.from_pyfile(str(secrets_file)) ## END: SECRETS -- cgit v1.2.3