diff --git a/source/conf.py b/source/conf.py index a1ba9ee..2b213e5 100644 --- a/source/conf.py +++ b/source/conf.py @@ -62,58 +62,60 @@ def conf_load( path : str ): global _conf_data - if (not _os.path.exists(path)): - pass - else: - conf_data_raw = _json.loads(file_read(path)) - for pair in conf_data_raw.get("url", {}).items(): - if ("host" in pair[1]): - pass - else: - raise ValueError("flawed conf: missing mandatory value 'host' for url entry '%s'" % pair[0]) - _conf_data = { - "url": convey( - ( - { - "test": { - "scheme": "https", - "host": "api.ote.domrobot.com", - "port": 443, - "path": "jsonrpc/" - }, - "production": { - "scheme": "https", - "host": "api.domrobot.com", - "port": 443, - "path": "jsonrpc/" - } + conf_data_raw = ( + _json.loads(file_read(path)) + if _os.path.exists(path) else + {} + ) + for pair in conf_data_raw.get("url", {}).items(): + if ("host" in pair[1]): + pass + else: + raise ValueError("flawed conf: missing mandatory value 'host' for url entry '%s'" % pair[0]) + _conf_data = { + "url": convey( + ( + { + "test": { + "scheme": "https", + "host": "api.ote.domrobot.com", + "port": 443, + "path": "jsonrpc/" + }, + "production": { + "scheme": "https", + "host": "api.domrobot.com", + "port": 443, + "path": "jsonrpc/" } - | - conf_data_raw.get("url", {}) - ), - [ - lambda x: x.items(), - lambda pairs: map( - lambda pair: ( - pair[0], - { - "scheme": pair[1].get("scheme", "https"), - "host": pair[1]["host"], - "port": pair[1].get("port", 443), - "path": pair[1].get("path", "jsonrpc/"), - } - ), - pairs - ), - dict, - ] + } + | + conf_data_raw.get("url", {}) ), - "environment": conf_data_raw.get("environment", "production"), - "account": { - "username": conf_data_raw.get("account", {}).get("username", None), - "password": conf_data_raw.get("account", {}).get("password", None), - } + [ + lambda x: x.items(), + lambda pairs: map( + lambda pair: ( + pair[0], + { + "scheme": pair[1].get("scheme", "https"), + "host": pair[1]["host"], + "port": pair[1].get("port", 443), + "path": pair[1].get("path", "jsonrpc/"), + } + ), + pairs + ), + dict, + ] + ), + "environment": conf_data_raw.get("environment", "production"), + "account": { + "username": conf_data_raw.get("account", {}).get("username", None), + "password": conf_data_raw.get("account", {}).get("password", None), } + } + print(_json.dumps(_conf_data, indent = "\t")) def conf_get(