diff options
-rw-r--r-- | jimbrella/config.py | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/jimbrella/config.py b/jimbrella/config.py index 77e944e..85833d0 100644 --- a/jimbrella/config.py +++ b/jimbrella/config.py @@ -1,14 +1,22 @@ -# jForm -JFORM_TAKEAWAY_URL = ( - "https://wj.sjtu.edu.cn/api/v1/public/export/900e25bf6a039da04da7c5165a7cd41a/json" -) -# JFORM_GIVEBACK_URL= ( -# "https://wj.sjtu.edu.cn/api/v1/public/export/900e25bf6a039da04da7c5165a7cd41a/json" -# ) -JFORM_BOOKMARK_DIR = "/home/fkfd/p/jimbrella/" - -# database -DATABASE_PATH = "/home/fkfd/p/jimbrella/jimbrella.db.csv" - -# rules of service -DUE_HOURS = 72 +import os +import toml + +config_path = os.environ["JIMBRELLA_CONFIG"] or "/opt/jimbrella/config.toml" + +f = open(config_path) +config = toml.load(f) +f.close() + +FLASK_SECRET_KEY = config["flask"]["secret_key"] + +JFORM_TAKEAWAY_URL = config["jform"]["takeaway_url"] +JFORM_GIVEBACK_URL = config["jform"]["giveback_url"] +JFORM_BOOKMARK_DIR = config["jform"]["bookmark_dir"] + +DATABASE_PATH = config["db"]["db_path"] +USERS_PATH = config["db"]["users_path"] + +DUE_HOURS = config["rules"]["due_hours"] + +LOG_PATH = config["logging"]["log_path"] +ADMIN_LOG_PATH = config["logging"]["admin_log_path"] |