dncurrency/nano/node/websocketconfig.cpp
cryptocode 016f15bd0e
Remove json config code (#3655)
* Remove json config code

This improves compile/test times a bit. The json->toml upgrade paths are removed as well. In the unlikely case someone needs to upgrade from v19.x and earlier, the solution is to run a v2x node (prior to this change) to perform the upgrade.

Closes #3530

* Remove stat_config json deserialization as well

* Remove stat_config header's deserialize_json and jsonconfig::read_and_update
2022-01-12 23:02:09 +00:00

28 lines
1.1 KiB
C++

#include <nano/boost/asio/ip/address_v6.hpp>
#include <nano/lib/tomlconfig.hpp>
#include <nano/node/websocketconfig.hpp>
nano::websocket::config::config (nano::network_constants & network_constants) :
network_constants{ network_constants },
port{ network_constants.default_websocket_port },
address{ boost::asio::ip::address_v6::loopback ().to_string () }
{
}
nano::error nano::websocket::config::serialize_toml (nano::tomlconfig & toml) const
{
toml.put ("enable", enabled, "Enable or disable WebSocket server.\ntype:bool");
toml.put ("address", address, "WebSocket server bind address.\ntype:string,ip");
toml.put ("port", port, "WebSocket server listening port.\ntype:uint16");
return toml.get_error ();
}
nano::error nano::websocket::config::deserialize_toml (nano::tomlconfig & toml)
{
toml.get<bool> ("enable", enabled);
boost::asio::ip::address_v6 address_l;
toml.get_optional<boost::asio::ip::address_v6> ("address", address_l, boost::asio::ip::address_v6::loopback ());
address = address_l.to_string ();
toml.get<uint16_t> ("port", port);
return toml.get_error ();
}