From 86c2a5d69dc838a629d393e9c47032d18385f86d Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 5 May 2021 01:03:00 +0200 Subject: [PATCH] lib: handle errors when reading config from file:// Signed-off-by: Jens Langhammer --- authentik/lib/config.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/authentik/lib/config.py b/authentik/lib/config.py index 615c8c9d2..c71d9a573 100644 --- a/authentik/lib/config.py +++ b/authentik/lib/config.py @@ -87,8 +87,11 @@ class ConfigLoader: if url.scheme == "env": value = os.getenv(url.netloc, url.query) if url.scheme == "file": - with open(url.netloc, "r") as _file: - value = _file.read() + try: + with open(url.netloc, "r") as _file: + value = _file.read() + except OSError: + self._log("error", f"Failed to read config value from {url.netloc}") return value def update_from_file(self, path: str):