Make gRPC and HTTP on by default
This commit is contained in:
parent
543e9457b7
commit
fa6ba51eb7
@ -16,7 +16,7 @@ pub struct Config {
|
|||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Config {
|
Config {
|
||||||
enabled: true, // rest_api enabled by default
|
enabled: true,
|
||||||
listen_address: Ipv4Addr::new(127, 0, 0, 1),
|
listen_address: Ipv4Addr::new(127, 0, 0, 1),
|
||||||
port: 5052,
|
port: 5052,
|
||||||
}
|
}
|
||||||
@ -25,8 +25,8 @@ impl Default for Config {
|
|||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn apply_cli_args(&mut self, args: &ArgMatches) -> Result<(), &'static str> {
|
pub fn apply_cli_args(&mut self, args: &ArgMatches) -> Result<(), &'static str> {
|
||||||
if args.is_present("api") {
|
if args.is_present("no-api") {
|
||||||
self.enabled = true;
|
self.enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(rpc_address) = args.value_of("api-address") {
|
if let Some(rpc_address) = args.value_of("api-address") {
|
||||||
|
@ -16,7 +16,7 @@ pub struct Config {
|
|||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Config {
|
Config {
|
||||||
enabled: false, // rpc disabled by default
|
enabled: true,
|
||||||
listen_address: Ipv4Addr::new(127, 0, 0, 1),
|
listen_address: Ipv4Addr::new(127, 0, 0, 1),
|
||||||
port: 5051,
|
port: 5051,
|
||||||
}
|
}
|
||||||
@ -25,8 +25,8 @@ impl Default for Config {
|
|||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn apply_cli_args(&mut self, args: &ArgMatches) -> Result<(), &'static str> {
|
pub fn apply_cli_args(&mut self, args: &ArgMatches) -> Result<(), &'static str> {
|
||||||
if args.is_present("rpc") {
|
if args.is_present("no-grpc") {
|
||||||
self.enabled = true;
|
self.enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(rpc_address) = args.value_of("rpc-address") {
|
if let Some(rpc_address) = args.value_of("rpc-address") {
|
||||||
|
@ -80,7 +80,12 @@ pub fn start_server<T: BeaconChainTypes + Clone + 'static>(
|
|||||||
let spawn_rpc = {
|
let spawn_rpc = {
|
||||||
server.start();
|
server.start();
|
||||||
for &(ref host, port) in server.bind_addrs() {
|
for &(ref host, port) in server.bind_addrs() {
|
||||||
info!(log, "gRPC listening on {}:{}", host, port);
|
info!(
|
||||||
|
log,
|
||||||
|
"gRPC API started";
|
||||||
|
"port" => port,
|
||||||
|
"host" => host,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
rpc_exit.and_then(move |_| {
|
rpc_exit.and_then(move |_| {
|
||||||
info!(log, "RPC Server shutting down");
|
info!(log, "RPC Server shutting down");
|
||||||
|
@ -120,10 +120,9 @@ fn main() {
|
|||||||
* gRPC parameters.
|
* gRPC parameters.
|
||||||
*/
|
*/
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("rpc")
|
Arg::with_name("no-grpc")
|
||||||
.long("rpc")
|
.long("no-grpc")
|
||||||
.value_name("RPC")
|
.help("Disable the gRPC server.")
|
||||||
.help("Enable the RPC server.")
|
|
||||||
.takes_value(false),
|
.takes_value(false),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
@ -142,10 +141,9 @@ fn main() {
|
|||||||
)
|
)
|
||||||
/* Client related arguments */
|
/* Client related arguments */
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("api")
|
Arg::with_name("no-api")
|
||||||
.long("api")
|
.long("no-api")
|
||||||
.value_name("API")
|
.help("Disable RESTful HTTP API server.")
|
||||||
.help("Enable the RESTful HTTP API server.")
|
|
||||||
.takes_value(false),
|
.takes_value(false),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
Loading…
Reference in New Issue
Block a user