summaryrefslogtreecommitdiff
path: root/jimbrella/config.py
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2022-02-05 16:39:41 +0800
committerFrederick Yin <fkfd@fkfd.me>2022-02-05 16:39:41 +0800
commitfcc3ce60bcfa57734a51723717fe681ee4bf1327 (patch)
treec8d883a6cd2b898fed85a7f717be34de242ded25 /jimbrella/config.py
parent14feb6a4378668d054d28a1335eacd2026b621dc (diff)
Config format switched to .ini
Eliminated toml from dependency list
Diffstat (limited to 'jimbrella/config.py')
-rw-r--r--jimbrella/config.py26
1 files changed, 4 insertions, 22 deletions
diff --git a/jimbrella/config.py b/jimbrella/config.py
index 81e5d09..0759f50 100644
--- a/jimbrella/config.py
+++ b/jimbrella/config.py
@@ -1,30 +1,12 @@
+from configparser import ConfigParser
import os
from pathlib import Path
-import toml
config_path = (
os.environ["JIMBRELLA_CONFIG"]
if "JIMBRELLA_CONFIG" in os.environ
- else "/opt/jimbrella/config.toml"
+ else "/opt/jimbrella/config.ini"
)
-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 = JIMBRELLA_DIR / Path(config["jform"]["bookmark_dir"])
-
-DATABASE_PATH = JIMBRELLA_DIR / Path(config["db"]["db_path"])
-
-DUE_HOURS = config["rules"]["due_hours"]
-
-LOG_PATH = JIMBRELLA_DIR / Path(config["logging"]["log_path"])
-ADMIN_LOG_PATH = JIMBRELLA_DIR / Path(config["logging"]["admin_log_path"])
+config = ConfigParser()
+config.read(config_path)