From 3270e3fe2c38e40695eaf6bd5e86e38d55c3ec02 Mon Sep 17 00:00:00 2001 From: Kristian Krsnik Date: Mon, 5 Aug 2024 10:41:51 +0200 Subject: [PATCH] Can Also read in API Keys from a file --- src/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.py b/src/main.py index df95677..54a405d 100644 --- a/src/main.py +++ b/src/main.py @@ -26,6 +26,10 @@ BUFFER_SIZE = convert_to_bytes(CONFIG['buffer-size']) MAX_SIZE = convert_to_bytes(CONFIG['max-size']) MAX_DATA = convert_to_bytes(CONFIG['max-data']) AUTHORIZED_KEYS = CONFIG['keys'] +if isinstance(AUTHORIZED_KEYS, str): + with open(AUTHORIZED_KEYS) as file: + AUTHORIZED_KEYS = list( + filter(lambda x: x.strip() != '', file.read().splitlines())) DATABASE = CONFIG['database'] if not exists(DATABASE):