mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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:
parent
2915abb9d3
commit
2f5f5583be
5 changed files with 32 additions and 18 deletions
|
@ -1,15 +1,12 @@
|
|||
import configparser
|
||||
import mysql.connector
|
||||
import os
|
||||
|
||||
import config
|
||||
|
||||
|
||||
class Connection:
|
||||
_conn = None
|
||||
|
||||
def __init__(self):
|
||||
config = configparser.RawConfigParser()
|
||||
config.read(os.path.dirname(os.path.realpath(__file__)) + "/../conf/config")
|
||||
|
||||
aur_db_host = config.get('database', 'host')
|
||||
aur_db_name = config.get('database', 'name')
|
||||
aur_db_user = config.get('database', 'user')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue