Separate the handling of envvars by prefix

This commit is contained in:
Bálint Bokros
2018-02-09 14:48:37 +01:00
parent 2499c4759e
commit 4f181b8f09
6 changed files with 19 additions and 12 deletions

View File

@ -1,10 +1,3 @@
from os import environ, getenv
from collections import namedtuple
from envvars import generate_namedtuple_from_prefixed_envvars
TFW_PREFIX = 'TFW_'
tfwenvvars = {envvar.replace(TFW_PREFIX, '', 1): environ.get(envvar)
for envvar in environ.keys()
if envvar.startswith(TFW_PREFIX)}
tfwenv = namedtuple('tfwenvtuple', tfwenvvars)(**tfwenvvars)
AVATAO_SECRET = getenv('AVATAO_SECRET', 'secret')
tfwenv = generate_namedtuple_from_prefixed_envvars('TFW_', 'tfwenvtuple')