More flexible management for included config files paths
This commit is contained in:
parent
62045c2b5c
commit
09c1598829
2 changed files with 6 additions and 7 deletions
|
@ -68,13 +68,13 @@ class Daemon:
|
||||||
f.write(str(os.getpid()))
|
f.write(str(os.getpid()))
|
||||||
|
|
||||||
self.config_file = config_file
|
self.config_file = config_file
|
||||||
|
Config.init(self.config_file)
|
||||||
|
logging.basicConfig(**Config.get('logging'))
|
||||||
|
|
||||||
self.event_processor = EventProcessor()
|
self.event_processor = EventProcessor()
|
||||||
self.requests_to_process = requests_to_process
|
self.requests_to_process = requests_to_process
|
||||||
self.processed_requests = 0
|
self.processed_requests = 0
|
||||||
|
|
||||||
Config.init(self.config_file)
|
|
||||||
logging.basicConfig(**Config.get('logging'))
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def build_from_cmdline(cls, args):
|
def build_from_cmdline(cls, args):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -117,9 +117,8 @@ class Config(object):
|
||||||
|
|
||||||
|
|
||||||
def _read_config_file(self, cfgfile):
|
def _read_config_file(self, cfgfile):
|
||||||
cfgfile_dir = os.path.expanduser(os.path.dirname(self._cfgfile))
|
cfgfile_dir = os.path.dirname(os.path.abspath(
|
||||||
if not os.path.isabs(cfgfile):
|
os.path.expanduser(cfgfile)))
|
||||||
cfgfile = os.path.join(cfgfile_dir, os.path.basename(cfgfile))
|
|
||||||
|
|
||||||
config = {}
|
config = {}
|
||||||
|
|
||||||
|
@ -135,7 +134,7 @@ class Config(object):
|
||||||
for include_file in include_files:
|
for include_file in include_files:
|
||||||
if not os.path.isabs(include_file):
|
if not os.path.isabs(include_file):
|
||||||
include_file = os.path.join(cfgfile_dir, include_file)
|
include_file = os.path.join(cfgfile_dir, include_file)
|
||||||
self._included_files.add(os.path.abspath(include_file))
|
self._included_files.add(include_file)
|
||||||
|
|
||||||
included_config = self._read_config_file(include_file)
|
included_config = self._read_config_file(include_file)
|
||||||
for incl_section in included_config.keys():
|
for incl_section in included_config.keys():
|
||||||
|
|
Loading…
Reference in a new issue