From 98133c0c3cf7e401cf5b85f7c4e9298bfcb4d00a Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Wed, 24 Nov 2021 19:48:40 +0800 Subject: New config entry "jimbrella_dir" Add explanation for jimbrella_dir --- jimbrella/config.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'jimbrella/config.py') 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"]) -- cgit v1.2.3