validate LITE_RPC_HTTP_ADDR in config (#331)
validate config value for LITE_RPC_HTTP_ADDR and LITE_RPC_WS_ADDR
This commit is contained in:
parent
2c42a536b6
commit
0678bc4f50
|
@ -1,5 +1,5 @@
|
|||
## LiteRpc
|
||||
LITE_RPC_HTTP_ADDR=http://0.0.0.0:8890
|
||||
LITE_RPC_HTTP_ADDR=[::]:8890
|
||||
LITE_RPC_WS_ADDR=[::]:8891
|
||||
|
||||
## RPC
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use std::borrow::Cow;
|
||||
use std::env;
|
||||
use std::fmt::{Debug, Display, Formatter};
|
||||
use std::net::SocketAddr;
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::postgres_logger;
|
||||
use crate::{
|
||||
|
@ -126,6 +128,9 @@ impl Config {
|
|||
|
||||
config.lite_rpc_ws_addr = env::var("LITE_RPC_WS_ADDR").unwrap_or(config.lite_rpc_ws_addr);
|
||||
|
||||
SocketAddr::from_str(&config.lite_rpc_http_addr).expect("invalid LITE_RPC_HTTP_ADDR");
|
||||
SocketAddr::from_str(&config.lite_rpc_ws_addr).expect("invalid LITE_RPC_WS_ADDR");
|
||||
|
||||
config.fanout_size = env::var("FANOUT_SIZE")
|
||||
.map(|size| size.parse().unwrap())
|
||||
.unwrap_or(config.fanout_size);
|
||||
|
|
Loading…
Reference in New Issue