19 lines
489 B
Python
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')
|