lib: add support for file:// protocol in config file

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-04 22:53:59 +02:00
parent b1c9126832
commit ba57bf4fa2
1 changed files with 3 additions and 0 deletions

View File

@ -86,6 +86,9 @@ class ConfigLoader:
url = urlparse(value) url = urlparse(value)
if url.scheme == "env": if url.scheme == "env":
value = os.getenv(url.netloc, url.query) value = os.getenv(url.netloc, url.query)
if url.scheme == "file":
with open(url.netloc, 'r') as _file:
value = _file.read()
return value return value
def update_from_file(self, path: str): def update_from_file(self, path: str):