feat: add --listen-port and rename --port
Changes: * adds --listen-port for specifying http port to listen on. * renames --port to --neptune-rpc-port which is clearer * updates README accordingly
This commit is contained in:
parent
e4fda1a806
commit
d99fe3ff84
@ -31,7 +31,8 @@ nohup neptune-explorer 2>&1 > /path/to/logs/neptune-explorer.log &
|
||||
|
||||
Notes:
|
||||
* The block-explorer automatically uses the same network (mainnet, testnet, etc) as the neptune-core instance it is connected to, and the network is displayed in the web interface.
|
||||
* if neptune-core RPC server is running on a non-standard port, you can provide it with the `--port` flag.
|
||||
* If neptune-core RPC server is running on a non-standard port, you can provide it with the `--neptune-rpc-port` flag.
|
||||
* neptune-explorer listens for http requests on port 3000 by default. This can be changed with the `--listen-port` flag.
|
||||
* Site name can be specified with the `--site-name` flag.
|
||||
|
||||
|
||||
@ -39,8 +40,6 @@ Notes:
|
||||
|
||||
Just navigate to http://localhost:3000/
|
||||
|
||||
(note: the port is not yet configurable.)
|
||||
|
||||
|
||||
## SSL/TLS, Nginx, etc.
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
// add state
|
||||
.with_state(shared_state);
|
||||
|
||||
let port = 3000;
|
||||
let port = Config::parse().listen_port;
|
||||
let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{port}"))
|
||||
.await
|
||||
.with_context(|| format!("Failed to bind to port {port}"))?;
|
||||
@ -85,7 +85,10 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
async fn rpc_client() -> Result<RPCClient, anyhow::Error> {
|
||||
// Create connection to neptune-core RPC server
|
||||
let args: Config = Config::parse();
|
||||
let server_socket = SocketAddr::new(std::net::IpAddr::V4(Ipv4Addr::LOCALHOST), args.port);
|
||||
let server_socket = SocketAddr::new(
|
||||
std::net::IpAddr::V4(Ipv4Addr::LOCALHOST),
|
||||
args.neptune_rpc_port,
|
||||
);
|
||||
let transport = tarpc::serde_transport::tcp::connect(server_socket, RpcJson::default)
|
||||
.await
|
||||
.with_context(|| {
|
||||
|
||||
@ -6,7 +6,11 @@ pub struct Config {
|
||||
#[clap(long, default_value = "Neptune Explorer", value_name = "site-name")]
|
||||
pub site_name: String,
|
||||
|
||||
/// Sets the server address to connect to.
|
||||
/// Sets the port to listen for http requests.
|
||||
#[clap(long, default_value = "3000", value_name = "PORT")]
|
||||
pub listen_port: u16,
|
||||
|
||||
/// Sets the neptune-core rpc server address to connect to.
|
||||
#[clap(long, default_value = "9799", value_name = "PORT")]
|
||||
pub port: u16,
|
||||
pub neptune_rpc_port: u16,
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user