mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
修改运行监控场站及设备信息查询接口
This commit is contained in:
@@ -10,8 +10,8 @@ AppOption Config::option;
|
||||
|
||||
bool Config::init(std::string filename)
|
||||
{
|
||||
NJsonNode jsonroot;
|
||||
bool ret = NJson::load(filename, jsonroot);
|
||||
njson jsonroot;
|
||||
bool ret = JSON::load(filename, jsonroot);
|
||||
if (!ret)
|
||||
{
|
||||
spdlog::error("[config] load config file failed, filename={}", filename);
|
||||
@@ -21,7 +21,7 @@ bool Config::init(std::string filename)
|
||||
|
||||
if (jsonroot.contains("database"))
|
||||
{
|
||||
NJsonNode json = jsonroot.at("database");
|
||||
njson json = jsonroot.at("database");
|
||||
option.database.host = json.contains("host") ? json.at("host") : "";
|
||||
option.database.port = json.contains("port") ? json.at("port") : 0;
|
||||
option.database.user = json.contains("user") ? json.at("user") : "";
|
||||
@@ -37,11 +37,11 @@ bool Config::init(std::string filename)
|
||||
|
||||
if (jsonroot.contains("http"))
|
||||
{
|
||||
NJsonNode json = jsonroot.at("http");
|
||||
njson json = jsonroot.at("http");
|
||||
std:string token;
|
||||
NJson::read(json, "token", token);
|
||||
JSON::read(json, "token", token);
|
||||
option.http.useToken = !token.empty();
|
||||
NJson::read(json, "port", option.http.port);
|
||||
JSON::read(json, "port", option.http.port);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -50,10 +50,10 @@ bool Config::init(std::string filename)
|
||||
|
||||
if (jsonroot.contains("mqtt"))
|
||||
{
|
||||
NJsonNode json = jsonroot.at("mqtt");
|
||||
NJson::read(json, "host", option.mqtt.host);
|
||||
NJson::read(json, "username", option.mqtt.username);
|
||||
NJson::read(json, "password", option.mqtt.password);
|
||||
njson json = jsonroot.at("mqtt");
|
||||
JSON::read(json, "host", option.mqtt.host);
|
||||
JSON::read(json, "username", option.mqtt.username);
|
||||
JSON::read(json, "password", option.mqtt.password);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user