mirror of https://git.48k.eu/ogcli/
Check required config params are in config file
In case a required config param is not in ogcli.json config file, this exits the program with an error code.master
parent
be18d619e6
commit
7483cb76a2
6
ogcli.py
6
ogcli.py
|
@ -18,6 +18,12 @@ class CLI():
|
|||
except:
|
||||
sys.exit(f'ERROR: cannot open {OG_CLI_CFG_PATH}')
|
||||
|
||||
required_cfg_params = {'api_token', 'ip', 'port'}
|
||||
difference_cfg_params = required_cfg_params - self.cfg.keys()
|
||||
if len(difference_cfg_params) > 0:
|
||||
sys.exit(f'Missing {difference_cfg_params} key in '
|
||||
f'json config file')
|
||||
|
||||
self.ogcli = OgCLI(self.cfg)
|
||||
|
||||
parser = argparse.ArgumentParser(prog='ogcli')
|
||||
|
|
Loading…
Reference in New Issue