def get_config(config_filename=get_default_config_filename(), secrets_file='/secrets'):
config = ConfigParser()
logger.debug('config filename: {}'.format(config_filename))
secrets = _load_secrets(filename=secrets_file)
if secrets:
from cryptography.fernet import Fernet
f = Fernet(secrets['encryption_key'].encode())
with open(config_filename, 'rb') as cfg:
cfg_content = f.decrypt(cfg.read())
print(cfg_content)
config.read_string(cfg_content.decode("utf-8") )
else:
config.read(config_filename)
expand_env_vars(config)
return config
评论列表
文章目录