Add config option for http listen address
This commit is contained in:
parent
21b5b99022
commit
a3c41ee4d6
@ -4,12 +4,17 @@ use signal_hook::consts::signal;
|
||||
use signal_hook_tokio::Signals;
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
use std::net::SocketAddr;
|
||||
use std::path;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version)]
|
||||
#[command(about = "A gateway to another dimension")]
|
||||
struct Cli {
|
||||
#[arg(long, default_value_t = SocketAddr::from_str("127.0.0.1:3030").unwrap(), env = "GATEWAY_HTTP_LISTEN_ADDR")]
|
||||
http_listen_addr: SocketAddr,
|
||||
|
||||
#[arg(long, required = true, env = "GATEWAY_ORIGIN_STORE_GIT_DIR_PATH")]
|
||||
origin_store_git_dir_path: Option<path::PathBuf>,
|
||||
|
||||
@ -68,7 +73,7 @@ async fn main() {
|
||||
let service = gateway::service::new(manager).expect("service initialized");
|
||||
|
||||
let (addr, server) =
|
||||
warp::serve(service).bind_with_graceful_shutdown(([127, 0, 0, 1], 3030), async {
|
||||
warp::serve(service).bind_with_graceful_shutdown(config.http_listen_addr, async {
|
||||
stop_ch_rx.await.ok();
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user