This commit is contained in:
parent
384f54e970
commit
6903043ab5
|
@ -1,25 +1,6 @@
|
||||||
import logging
|
from secret_loader import SecretLoader
|
||||||
import os
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
logger.setLevel(logging.INFO)
|
|
||||||
|
|
||||||
ENV_KEY_PREFIX = 'CF_PD_'
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
load_secret = SecretLoader(env_key_prefix = 'CF_PD').load
|
||||||
|
|
||||||
# Crunchyroll
|
# Crunchyroll
|
||||||
CRUNCHYROLL_DEVICE_ID = load_secret('CRUNCHYROLL_DEVICE_ID')
|
CRUNCHYROLL_DEVICE_ID = load_secret('CRUNCHYROLL_DEVICE_ID')
|
||||||
|
|
|
@ -8,3 +8,4 @@ frozendict
|
||||||
python-kucoin
|
python-kucoin
|
||||||
krakenex
|
krakenex
|
||||||
fin-depo @ git+https://gitfub.space/Jmaa/fin-depo.git
|
fin-depo @ git+https://gitfub.space/Jmaa/fin-depo.git
|
||||||
|
secret_loader @ https://gitfub.space/Jmaa/secret_loader
|
||||||
|
|
Loading…
Reference in New Issue
Block a user