git-interface: Factor out configuration file parsing

Add a new module that automatically locates the configuration file and
provides methods to obtain the values of configuration options.

Use the new module instead of ConfigParser everywhere.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2016-08-03 20:21:40 +02:00
parent 2915abb9d3
commit 2f5f5583be
5 changed files with 32 additions and 18 deletions

View file

@ -1,16 +1,13 @@
#!/usr/bin/python3
import configparser
import os
import re
import shlex
import sys
import config
import db
config = configparser.RawConfigParser()
config.read(os.path.dirname(os.path.realpath(__file__)) + "/../conf/config")
repo_path = config.get('serve', 'repo-path')
repo_regex = config.get('serve', 'repo-regex')
git_shell_cmd = config.get('serve', 'git-shell-cmd')