浏览代码

add config file argument to parser

Karsten Böddeker 7 年之前
父节点
当前提交
ed65306639
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      ext-respondd.py

+ 2 - 1
ext-respondd.py

@@ -424,6 +424,7 @@ def sendResponse(request, compress):
 
 parser = argparse.ArgumentParser()
 
+parser.add_argument( '-c', '--cfg', default='config.json', metavar='<file>', help='Config File',required=False,)
 parser.add_argument( '-d', '--debug', action='store_true', help='Debug Output',required=False,)
 parser.add_argument( '-v', '--verbose', action='store_true', help='Verbose Output',required=False)
 
@@ -432,7 +433,7 @@ options = vars(args)
 
 config = {}
 try:
-    with open("config.json", 'r') as cfg_handle:
+    with open(options['cfg'], 'r') as cfg_handle:
         config = json.load(cfg_handle)
 except IOError:
     raise