mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
实现MQTT功能, 修改HTTP接口
This commit is contained in:
@@ -32,7 +32,7 @@ bool Config::init(std::string filename)
|
||||
}
|
||||
else
|
||||
{
|
||||
spdlog::info("[config] parse database failed: not found. host={}", option.database.host);
|
||||
spdlog::info("[config] parse database failed: not found.");
|
||||
}
|
||||
|
||||
if (jsonroot.contains("http"))
|
||||
@@ -43,6 +43,21 @@ bool Config::init(std::string filename)
|
||||
option.http.useToken = !token.empty();
|
||||
NJson::read(json, "port", option.http.port);
|
||||
}
|
||||
else
|
||||
{
|
||||
spdlog::info("[config] parse http failed: not found.");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
spdlog::info("[config] parse mqtt failed: not found.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user