diff options
author | Frederick Muriuki Muriithi | 2024-04-23 12:39:27 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-04-23 14:10:37 +0300 |
commit | 30879312326e4e0ac9c285c7db55b5c3c6f0e491 (patch) | |
tree | 58bc98146c79893df852a29a4920679cf25c6317 /gn2 | |
parent | 062c78f4358deecdf80403baffbc76ab8b6185fb (diff) | |
download | genenetwork2-30879312326e4e0ac9c285c7db55b5c3c6f0e491.tar.gz |
Don't fail startup due to missing config.
Diffstat (limited to 'gn2')
-rw-r--r-- | gn2/wqflask/__init__.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gn2/wqflask/__init__.py b/gn2/wqflask/__init__.py index f6e9ef53..c77895c1 100644 --- a/gn2/wqflask/__init__.py +++ b/gn2/wqflask/__init__.py @@ -2,6 +2,7 @@ # pylint: disable=C0413,E0611 import os import time +import logging import datetime from typing import Tuple from pathlib import Path @@ -56,8 +57,13 @@ def numcoll(): def parse_ssl_key(app: Flask, keyconfig: str): """Parse key file paths into objects""" - with open(app.config[keyconfig]) as _sslkey: - app.config[keyconfig] = JsonWebKey.import_key(_sslkey.read()) + keypath = app.config.get(keyconfig, "").strip() + if not bool(keypath): + logging.error(f"Expected configuration '{keyconfig}'") + return + + with open(keypath) as _sslkey: + app.config[keyconfig] = JsonWebKey.import_key(_sslkey.read()) |