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>
|
2020-07-09 13:11:26 +00:00
|
|
|
# Copyright (C) 2020 by Martin Rey <martin.rey@mailbox.org>
|
2020-07-01 19:21:39 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: 0BSD
|
|
|
|
|
2020-07-09 13:11:26 +00:00
|
|
|
from argparse import ArgumentParser
|
2020-07-01 19:21:39 +00:00
|
|
|
from pytoml import load
|
2020-07-09 16:14:09 +00:00
|
|
|
from sys import argv
|
2020-07-01 19:21:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
config = {
|
2020-07-02 12:31:53 +00:00
|
|
|
'database_connection': 'sqlite:////tmp/kibicara.sqlite',
|
|
|
|
'frontend_path': None,
|
2020-07-06 14:49:16 +00:00
|
|
|
'root_url': 'http://localhost:8000/',
|
2020-07-02 12:31:53 +00:00
|
|
|
}
|
2020-07-01 19:21:39 +00:00
|
|
|
|
2020-07-10 21:50:57 +00:00
|
|
|
if argv[0].endswith('kibicara'):
|
2020-07-09 16:14:09 +00:00
|
|
|
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
|
|
|
|
2020-07-09 16:14:09 +00:00
|
|
|
try:
|
|
|
|
with open(args.configfile) as configfile:
|
|
|
|
config.update(load(configfile))
|
|
|
|
except FileNotFoundError:
|
|
|
|
# run with default config
|
|
|
|
pass
|