read correct config from halfapiconfig
This commit is contained in:
parent
7f3fd74a31
commit
0fffab106f
|
@ -4,12 +4,6 @@ from os import environ
|
||||||
import sys
|
import sys
|
||||||
from configparser import ConfigParser
|
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={
|
config = ConfigParser(defaults={
|
||||||
'project': {
|
'project': {
|
||||||
'host': '127.0.0.1',
|
'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')
|
CONF_DIR = environ.get('HALFAPI_CONF_DIR', '/etc/halfapi')
|
||||||
|
|
||||||
config.read(filenames=[os.path.join(
|
config.read(filenames=[os.path.join(
|
||||||
|
|
Loading…
Reference in New Issue