[fix]
This commit is contained in:
parent
c9e8895a1d
commit
f0d1683050
100
source/conf.py
100
source/conf.py
|
|
@ -62,58 +62,60 @@ def conf_load(
|
||||||
path : str
|
path : str
|
||||||
):
|
):
|
||||||
global _conf_data
|
global _conf_data
|
||||||
if (not _os.path.exists(path)):
|
conf_data_raw = (
|
||||||
pass
|
_json.loads(file_read(path))
|
||||||
else:
|
if _os.path.exists(path) else
|
||||||
conf_data_raw = _json.loads(file_read(path))
|
{}
|
||||||
for pair in conf_data_raw.get("url", {}).items():
|
)
|
||||||
if ("host" in pair[1]):
|
for pair in conf_data_raw.get("url", {}).items():
|
||||||
pass
|
if ("host" in pair[1]):
|
||||||
else:
|
pass
|
||||||
raise ValueError("flawed conf: missing mandatory value 'host' for url entry '%s'" % pair[0])
|
else:
|
||||||
_conf_data = {
|
raise ValueError("flawed conf: missing mandatory value 'host' for url entry '%s'" % pair[0])
|
||||||
"url": convey(
|
_conf_data = {
|
||||||
(
|
"url": convey(
|
||||||
{
|
(
|
||||||
"test": {
|
{
|
||||||
"scheme": "https",
|
"test": {
|
||||||
"host": "api.ote.domrobot.com",
|
"scheme": "https",
|
||||||
"port": 443,
|
"host": "api.ote.domrobot.com",
|
||||||
"path": "jsonrpc/"
|
"port": 443,
|
||||||
},
|
"path": "jsonrpc/"
|
||||||
"production": {
|
},
|
||||||
"scheme": "https",
|
"production": {
|
||||||
"host": "api.domrobot.com",
|
"scheme": "https",
|
||||||
"port": 443,
|
"host": "api.domrobot.com",
|
||||||
"path": "jsonrpc/"
|
"port": 443,
|
||||||
}
|
"path": "jsonrpc/"
|
||||||
}
|
}
|
||||||
|
|
}
|
||||||
conf_data_raw.get("url", {})
|
|
|
||||||
),
|
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,
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
"environment": conf_data_raw.get("environment", "production"),
|
[
|
||||||
"account": {
|
lambda x: x.items(),
|
||||||
"username": conf_data_raw.get("account", {}).get("username", None),
|
lambda pairs: map(
|
||||||
"password": conf_data_raw.get("account", {}).get("password", None),
|
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(
|
def conf_get(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue