summaryrefslogtreecommitdiff
path: root/jimbrella/config.py
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2021-11-24 19:48:40 +0800
committerFrederick Yin <fkfd@fkfd.me>2021-11-24 20:14:23 +0800
commit98133c0c3cf7e401cf5b85f7c4e9298bfcb4d00a (patch)
tree5d8e718ef3684bd7a77db5c9528c993a3b80492a /jimbrella/config.py
parentfea01028d97dd8a11673912fd0c6f1453c34adad (diff)
New config entry "jimbrella_dir"
Add explanation for jimbrella_dir
Diffstat (limited to 'jimbrella/config.py')
-rw-r--r--jimbrella/config.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/jimbrella/config.py b/jimbrella/config.py
index dd4aa00..48265e9 100644
--- a/jimbrella/config.py
+++ b/jimbrella/config.py
@@ -1,4 +1,5 @@
import os
+from pathlib import Path
import toml
config_path = (
@@ -11,18 +12,20 @@ f = open(config_path)
config = toml.load(f)
f.close()
+JIMBRELLA_DIR = Path(config["jimbrella_dir"])
+
FLASK_SECRET_KEY = config["flask"]["secret_key"]
ACCEPT_NEW_USERS = config["user"]["accept_new_users"]
-JFORM_TAKEAWAY_URL = config["jform"]["takeaway_url"]
-JFORM_GIVEBACK_URL = config["jform"]["giveback_url"]
-JFORM_BOOKMARK_DIR = config["jform"]["bookmark_dir"]
+JFORM_TAKEAWAY_URL = JIMBRELLA_DIR / Path(config["jform"]["takeaway_url"])
+JFORM_GIVEBACK_URL = JIMBRELLA_DIR / Path(config["jform"]["giveback_url"])
+JFORM_BOOKMARK_DIR = JIMBRELLA_DIR / Path(config["jform"]["bookmark_dir"])
-DATABASE_PATH = config["db"]["db_path"]
-USERS_PATH = config["db"]["users_path"]
+DATABASE_PATH = JIMBRELLA_DIR / Path(config["db"]["db_path"])
+USERS_PATH = JIMBRELLA_DIR / 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"]
+LOG_PATH = JIMBRELLA_DIR / Path(config["logging"]["log_path"])
+ADMIN_LOG_PATH = JIMBRELLA_DIR / Path(config["logging"]["admin_log_path"])