summaryrefslogtreecommitdiff
path: root/jimbrella/config.py
blob: 48265e94dfb7696c5686115c12015c15ee182827 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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"
)

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 = 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 = JIMBRELLA_DIR / Path(config["db"]["db_path"])
USERS_PATH = JIMBRELLA_DIR / Path(config["db"]["users_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"])