balance-application/util/config.py
2024-10-10 15:22:13 +09:00

31 lines
565 B
Python

import os
from dotenv import load_dotenv
load_dotenv(verbose=True, override=True)
def _load_secret():
try:
tok = open("./secret_token.txt", "r").read()
except:
return ""
return tok
def db_url():
return os.getenv("DB_URL")
conn_param = "host=%s port=%s dbname=%s user=%s password=%s" % (
os.getenv("DB_URL"),
os.getenv("DB_PORT"),
os.getenv("DB_DATABASE"),
os.getenv("DB_USERNAME"),
os.getenv("DB_PASSWORD")
)
secret = _load_secret()
def get_otld():
ret = os.getenv("OTLD_SUPPORT")
if ret is "1" or ret is "true":
return True
return False