balance-application/util/config.py

32 lines
565 B
Python
Raw Normal View History

2024-09-10 04:14:09 +00:00
import os
from dotenv import load_dotenv
load_dotenv(verbose=True, override=True)
2024-09-10 04:14:09 +00:00
2024-09-12 02:34:09 +00:00
def _load_secret():
try:
tok = open("./secret_token.txt", "r").read()
except:
return ""
return tok
2024-09-13 05:28:09 +00:00
def db_url():
return os.getenv("DB_URL")
2024-09-10 04:14:09 +00:00
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")
)
2024-09-12 02:34:09 +00:00
secret = _load_secret()
2024-10-10 06:22:13 +00:00
def get_otld():
ret = os.getenv("OTLD_SUPPORT")
2024-10-10 06:35:41 +00:00
if ret == "1" or ret == "true":
2024-10-10 06:22:13 +00:00
return True
return False