1
0
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:
2018-03-22 02:50:01 +01:00
parent 48e6e66a4f
commit 3703c522fa
+14 -1
View File
@@ -65,4 +65,17 @@ class Config:
@staticmethod @staticmethod
def from_env(): 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)