1
0
personal-data/personal_data/secrets.py

54 lines
1.4 KiB
Python
Raw Permalink Normal View History

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
2024-04-23 20:58:25 +00:00
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
2024-04-23 20:58:25 +00:00
CRUNCHYROLL_DEVICE_ID = load_secret('CRUNCHYROLL_DEVICE_ID')
CRUNCHYROLL_AUTH = load_secret('CRUNCHYROLL_AUTH')
2024-04-16 22:38:57 +00:00
# FFXIV
FFXIV_CHARACTER_ID = load_secret('FFXIV_CHARACTER_ID')
2024-04-28 22:01:11 +00:00
# Playstation
PLAYSTATION_PSN_ID = load_secret('PLAYSTATION_PSN_ID')
2024-04-16 22:48:21 +00:00
# Partisia Blockchain
PBC_ACCOUNT_ADDRESS = load_secret('PBC_ACCOUNT_ADDRESS')
2024-05-16 22:24:01 +00:00
# Kucoin
KUCOIN_KEY = load_secret('KUCOIN_KEY')
KUCOIN_SECRET = load_secret('KUCOIN_SECRET')
KUCOIN_PASS = load_secret('KUCOIN_PASS')
2024-05-17 23:05:02 +00:00
# KRAKEN
KRAKEN_KEY = load_secret('KRAKEN_KEY')
KRAKEN_SECRET = load_secret('KRAKEN_SECRET')
2024-06-06 21:49:52 +00:00
# Home Assistant
HOME_ASSISTANT_ROOT = load_secret('HOME_ASSISTANT_ROOT')
HOME_ASSISTANT_LLAK = load_secret('HOME_ASSISTANT_LLAK')
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')