2020-05-04 22:06:03 +02:00
|
|
|
_conf_data = {
|
|
|
|
|
"url": {
|
|
|
|
|
"test": {
|
2023-10-26 11:53:17 +02:00
|
|
|
"scheme": "https",
|
2020-05-04 22:06:03 +02:00
|
|
|
"host": "api.ote.domrobot.com",
|
|
|
|
|
"port": 443,
|
|
|
|
|
"path": "jsonrpc/"
|
|
|
|
|
},
|
|
|
|
|
"production": {
|
2023-10-26 11:53:17 +02:00
|
|
|
"scheme": "https",
|
2020-05-04 22:06:03 +02:00
|
|
|
"host": "api.domrobot.com",
|
|
|
|
|
"port": 443,
|
|
|
|
|
"path": "jsonrpc/"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"environment": "production",
|
|
|
|
|
"account": {
|
|
|
|
|
"username": None,
|
|
|
|
|
"password": None
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def conf_load(
|
|
|
|
|
path : str
|
|
|
|
|
):
|
|
|
|
|
global _conf_data
|
|
|
|
|
if (not _os.path.exists(path)):
|
|
|
|
|
pass
|
|
|
|
|
else:
|
|
|
|
|
handle = open(path, "r")
|
|
|
|
|
content = handle.read()
|
|
|
|
|
handle.close()
|
|
|
|
|
data = _json.loads(content)
|
|
|
|
|
_conf_data = merge(_conf_data, data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def conf_get(
|
|
|
|
|
path : str
|
|
|
|
|
):
|
|
|
|
|
global _conf_data
|
|
|
|
|
return path_read(_conf_data, path.split("."))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def conf_set(
|
|
|
|
|
path : str,
|
|
|
|
|
value
|
|
|
|
|
):
|
|
|
|
|
global _conf_data
|
|
|
|
|
path_write(_conf_data, path.split("."), value)
|
|
|
|
|
|
|
|
|
|
|