mirror of
https://github.com/janLo/wallabag-kindle-consumer
synced 2026-06-19 19:08:00 +00:00
Get config from environment
This commit is contained in:
@@ -65,4 +65,17 @@ class Config:
|
||||
|
||||
@staticmethod
|
||||
def from_env():
|
||||
pass
|
||||
tmp = {}
|
||||
missing = []
|
||||
for key in Config.known_values:
|
||||
if key.upper() in os.environ:
|
||||
tmp[key] = os.environ[key.upper()]
|
||||
else:
|
||||
if key in Config.required_values:
|
||||
missing.append(key)
|
||||
|
||||
if 0 != len(missing):
|
||||
logger.warn("Environment config does not contain configs for: {lst}", lst=", ".join(missing))
|
||||
return None
|
||||
|
||||
return Config(**tmp)
|
||||
|
||||
Reference in New Issue
Block a user