1
0
fin-depo/test/secrets.py

19 lines
489 B
Python
Raw Normal View History

2024-06-20 21:00:22 +00:00
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')