diff --git a/halfapi/conf.py b/halfapi/conf.py index 3ebf49b..7b17306 100644 --- a/halfapi/conf.py +++ b/halfapi/conf.py @@ -4,12 +4,6 @@ from os import environ import sys from configparser import ConfigParser -with open('.halfapiconfig') as f: - PROJECT_NAME = f.read() - -if len(PROJECT_NAME) == 0: - raise Exception('Need a project name as argument') - config = ConfigParser(defaults={ 'project': { 'host': '127.0.0.1', @@ -20,6 +14,14 @@ config = ConfigParser(defaults={ } }) +config.read(filenames=['.halfapiconfig']) + +PROJECT_NAME = config.get('project', 'name') + +if len(PROJECT_NAME) == 0: + raise Exception('Need a project name as argument') + + CONF_DIR = environ.get('HALFAPI_CONF_DIR', '/etc/halfapi') config.read(filenames=[os.path.join(