2024-04-16 22:38:57 +00:00
|
|
|
import logging
|
|
|
|
import os
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
logger.setLevel(logging.INFO)
|
|
|
|
|
2024-04-17 21:54:05 +00:00
|
|
|
ENV_KEY_PREFIX = 'CF_PD_'
|
2024-04-16 22:38:57 +00:00
|
|
|
|
|
|
|
def load_secret(env_key: str) -> str:
|
|
|
|
filepath = os.environ.get(ENV_KEY_PREFIX + env_key)
|
|
|
|
if filepath is None:
|
|
|
|
filepath = f'./secrets/{env_key.lower()}'
|
|
|
|
try:
|
|
|
|
with open(filepath) as f:
|
|
|
|
value = f.read().strip()
|
|
|
|
logger.info('Loaded secret: %s', env_key)
|
|
|
|
return value
|
|
|
|
except Exception:
|
|
|
|
logger.exception('Could not load secret %s', env_key)
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
# Crunchyroll
|
|
|
|
CRUNCHYROLL_DEVICE_ID = load_secret('CRUNCHYROLL_DEVICE_ID')
|
|
|
|
CRUNCHYROLL_AUTH =load_secret('CRUNCHYROLL_AUTH')
|
|
|
|
|
|
|
|
# FFXIV
|
|
|
|
FFXIV_CHARACTER_ID = load_secret('FFXIV_CHARACTER_ID')
|
|
|
|
|
2024-04-16 22:48:21 +00:00
|
|
|
# Partisia Blockchain
|
|
|
|
PBC_ACCOUNT_ADDRESS = load_secret('PBC_ACCOUNT_ADDRESS')
|
|
|
|
|
2024-04-16 22:38:57 +00:00
|
|
|
# Email configuration
|
|
|
|
MAILGUN_API_KEY = load_secret('MAILGUN_API_KEY')
|
|
|
|
MAILGUN_DOMAIN = load_secret('MAILGUN_DOMAIN')
|
|
|
|
MAILGUN_RECIPIENT = load_secret('MAILGUN_RECIPIENT')
|