Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the operator to set the listening host IP address. #122

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions rust-connector-sdk/src/default_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ struct ServeCommand {
configuration: PathBuf,
#[arg(long, value_name = "ENDPOINT", env = "OTEL_EXPORTER_OTLP_ENDPOINT")]
otlp_endpoint: Option<String>,
#[arg(
long,
value_name = "HOST IP",
env = "HASURA_CONNECTOR_HOST",
default_value_t = net::IpAddr::V4(net::Ipv4Addr::UNSPECIFIED),
)]
host: net::IpAddr,
#[arg(
long,
value_name = "PORT",
Expand All @@ -67,8 +74,6 @@ struct ServeCommand {
service_token_secret: Option<String>,
#[arg(long, value_name = "NAME", env = "OTEL_SERVICE_NAME")]
service_name: Option<String>,
#[arg(long, env = "HASURA_ENABLE_V2_COMPATIBILITY")]
enable_v2_compatibility: bool,
}

#[derive(Clone, Parser)]
Expand Down Expand Up @@ -233,11 +238,8 @@ where
serve_command.service_token_secret.clone(),
);

let port = serve_command.port;
let address = net::SocketAddr::new(net::IpAddr::V4(net::Ipv4Addr::UNSPECIFIED), port);

let address = net::SocketAddr::new(serve_command.host, serve_command.port);
println!("Starting server on {}", address);

axum::Server::bind(&address)
.serve(router.into_make_service())
.with_graceful_shutdown(async {
Expand Down
Loading