aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-07-25 15:09:34 -0500
committerFrederick Muriuki Muriithi2024-07-26 16:45:30 -0500
commit9d9421c6fb28c3185a81adebbbaef4b42c18746f (patch)
treed4fa88742858248e73f3c97568b23a09f953b67e
parent0dd6a3b3c8464f80375918148fe2c6cdacd8f462 (diff)
downloadgn-uploader-9d9421c6fb28c3185a81adebbbaef4b42c18746f.tar.gz
Setup secrets from config file.
-rw-r--r--uploader/__init__.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/uploader/__init__.py b/uploader/__init__.py
index e9875cf..00ed7e7 100644
--- a/uploader/__init__.py
+++ b/uploader/__init__.py
@@ -30,8 +30,13 @@ def create_app():
override_settings_with_envvars(app, ignore=tuple())
- if "QCAPP_SECRETS" in os.environ:
- app.config.from_envvar("QCAPP_SECRETS")
+ secretsfile = app.config.get("UPLOADER_SECRETS", "").strip()
+ if bool(secretsfile):
+ secretsfile = Path(secretsfile).absolute()
+ app.config["UPLOADER_SECRETS"] = secretsfile
+ if secretsfile.exists():
+ # Silently ignore secrets if the file does not exist.
+ app.config.from_pyfile(secretsfile)
# setup jinja2 symbols
app.add_template_global(lambda : request.url, name="request_url")