diff options
Diffstat (limited to 'uploader')
-rw-r--r-- | uploader/__init__.py | 9 |
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") |