1
0
fin-depo/test/secrets.py
2024-06-20 23:01:41 +02:00

19 lines
489 B
Python

import logging
logger = logging.getLogger(__name__)
def load_secret(env_key: str) -> str:
filepath = f'./secrets/{env_key.lower()}'
try:
with open(filepath) as f:
return f.read().strip()
logger.info('Loaded secret: %s', env_key)
except Exception:
logger.exception("Could not load %s file '%s'", env_key, filepath)
return None
NORDNET_USERNAME = load_secret('NORDNET_USERNAME')
NORDNET_PASSWORD = load_secret('NORDNET_PASSWORD')