ticketfrei3/kibicara/config.py

35 lines
869 B
Python
Raw Normal View History

2020-07-01 19:21:39 +00:00
# Copyright (C) 2020 by Thomas Lindner <tom@dl6tom.de>
# Copyright (C) 2020 by Cathy Hu <cathy.hu@fau.de>
# Copyright (C) 2020 by Martin Rey <martin.rey@mailbox.org>
2020-07-01 19:21:39 +00:00
#
# SPDX-License-Identifier: 0BSD
from argparse import ArgumentParser
2020-07-01 19:21:39 +00:00
from pytoml import load
from sys import argv
2020-07-01 19:21:39 +00:00
config = {
'database_connection': 'sqlite:////tmp/kibicara.sqlite',
'frontend_path': None,
'root_url': 'http://localhost:8000/',
}
2020-07-01 19:21:39 +00:00
2020-07-10 21:50:57 +00:00
if argv[0].endswith('kibicara'):
parser = ArgumentParser()
parser.add_argument(
'-f',
'--config',
dest='configfile',
default='/etc/kibicara.conf',
help='path to config file',
)
args = parser.parse_args()
2020-07-01 19:21:39 +00:00
try:
with open(args.configfile) as configfile:
config.update(load(configfile))
except FileNotFoundError:
# run with default config
pass