add file env

This commit is contained in:
Philipp Rothmann 2022-10-25 16:24:22 +02:00
parent d1838267ea
commit 37e8e97853

View file

@ -1,8 +1,16 @@
import os
SECRET_KEY = os.environ.get("SECRET_KEY")
def env_file(key: str):
file_env = os.environ.get(f"{key}_FILE")
if os.path.exists(file_env):
return open(file_env).read().rstrip('\n')
return os.environ.get(key)
SECRET_KEY = env_file("SECRET_KEY")
HYDRA_CLIENT_ID = os.environ.get("HYDRA_CLIENT_ID")
HYDRA_CLIENT_SECRET = os.environ.get("HYDRA_CLIENT_SECRET")
HYDRA_CLIENT_SECRET = env_file("HYDRA_CLIENT_SECRET")
HYDRA_AUTHORIZATION_BASE_URL = os.environ.get("HYDRA_AUTHORIZATION_BASE_URL")
TOKEN_URL = os.environ.get("TOKEN_URL")
REDIRECT_URL = os.environ.get("REDIRECT_URL")