2016-01-18 15:33:29 +00:00
|
|
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
2015-09-18 11:55:31 +00:00
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
2015-05-27 12:08:46 +00:00
|
|
|
|
|
|
|
#include "RpcServerConfig.h"
|
2015-07-30 15:22:07 +00:00
|
|
|
#include "Common/CommandLine.h"
|
|
|
|
#include "CryptoNoteConfig.h"
|
2015-05-27 12:08:46 +00:00
|
|
|
|
|
|
|
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<std::string> arg_rpc_bind_ip = { "rpc-bind-ip", "", DEFAULT_RPC_IP };
|
|
|
|
const command_line::arg_descriptor<uint16_t> 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);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|