Move extensions.json file path to config file
This commit is contained in:
parent
d72ff01372
commit
6a227b4dce
@ -26,16 +26,19 @@ class DectConfig(ConfigBase):
|
||||
def check(self):
|
||||
return True
|
||||
|
||||
class ExtensionsConfig(ConfigBase):
|
||||
pass
|
||||
|
||||
class YateConfig(ConfigBase):
|
||||
pass
|
||||
|
||||
|
||||
class Config:
|
||||
def __init__(self, c):
|
||||
self._c = c
|
||||
self.controller = ControllerConfig(c.get("controller", {}))
|
||||
self.database = DatabaseConfig(c.get("database", {}))
|
||||
self.dect = DectConfig(c.get("dect", {}))
|
||||
self.extensions = ExtensionsConfig(c.get("extensions", {}))
|
||||
self.yate = YateConfig(c.get("yate", {}))
|
||||
|
||||
def check(self):
|
||||
|
@ -20,11 +20,10 @@ class FieldPOC:
|
||||
extensions = None
|
||||
temp_extensions = {}
|
||||
|
||||
def __init__(self, config_file_path, extensions_file_path):
|
||||
def __init__(self, config_file_path):
|
||||
logger.info("loading configuration")
|
||||
self.config_file_path = pathlib.Path(config_file_path)
|
||||
self._load_config()
|
||||
self.extensions_file_path = pathlib.Path(extensions_file_path)
|
||||
self._load_extensions()
|
||||
|
||||
logger.info("initialising queues")
|
||||
@ -92,4 +91,4 @@ class FieldPOC:
|
||||
self.config = config.Config(json.loads(self.config_file_path.read_text()))
|
||||
|
||||
def _load_extensions(self):
|
||||
self.extensions = extensions.Extensions(json.loads(self.extensions_file_path.read_text()))
|
||||
self.extensions = extensions.Extensions(json.loads(pathlib.Path(self.config.extensions.file).read_text()))
|
||||
|
@ -12,7 +12,6 @@ logger = logging.getLogger("fieldpoc.run")
|
||||
|
||||
ap = argparse.ArgumentParser(prog="fieldpoc")
|
||||
ap.add_argument("-c", "--config", dest="config_file_path", default="fieldpoc_config.json", help="Path to the fieldpoc config file")
|
||||
ap.add_argument("-e", "--extensions", dest="extensions_file_path", default="fieldpoc_extensions.json", help="Path to the fieldpoc extensions file")
|
||||
ap.add_argument('--init', dest="init", action='store_true')
|
||||
ap.add_argument('--debug', dest="debug", action='store_true')
|
||||
|
||||
@ -33,7 +32,7 @@ def run():
|
||||
|
||||
logger.info("prepared signal handling")
|
||||
|
||||
fp = fieldpoc.FieldPOC(config_file_path=args.config_file_path, extensions_file_path=args.extensions_file_path)
|
||||
fp = fieldpoc.FieldPOC(config_file_path=args.config_file_path)
|
||||
|
||||
if args.init:
|
||||
fp.init()
|
||||
|
@ -1,4 +1,7 @@
|
||||
{
|
||||
"extensions": {
|
||||
"file": "fieldpoc_extensions.json"
|
||||
},
|
||||
"controller": {
|
||||
"host": "127.0.0.1",
|
||||
"port": 9437
|
||||
|
Loading…
Reference in New Issue
Block a user