// Copyright (c) 2011-2016 The Cryptonote developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "RpcServerConfig.h" #include "Common/CommandLine.h" #include "CryptoNoteConfig.h" namespace CryptoNote { namespace { const std::string DEFAULT_RPC_IP = "127.0.0.1"; const uint16_t DEFAULT_RPC_PORT = RPC_DEFAULT_PORT; const command_line::arg_descriptor arg_rpc_bind_ip = { "rpc-bind-ip", "", DEFAULT_RPC_IP }; const command_line::arg_descriptor arg_rpc_bind_port = { "rpc-bind-port", "", DEFAULT_RPC_PORT }; } RpcServerConfig::RpcServerConfig() : bindIp(DEFAULT_RPC_IP), bindPort(DEFAULT_RPC_PORT) { } std::string RpcServerConfig::getBindAddress() const { return bindIp + ":" + std::to_string(bindPort); } void RpcServerConfig::initOptions(boost::program_options::options_description& desc) { command_line::add_arg(desc, arg_rpc_bind_ip); command_line::add_arg(desc, arg_rpc_bind_port); } void RpcServerConfig::init(const boost::program_options::variables_map& vm) { bindIp = command_line::get_arg(vm, arg_rpc_bind_ip); bindPort = command_line::get_arg(vm, arg_rpc_bind_port); } }