diff --git a/proxy/src/bin/pg_sni_router.rs b/proxy/src/bin/pg_sni_router.rs index b4fcbcefbd..7e1f6ea940 100644 --- a/proxy/src/bin/pg_sni_router.rs +++ b/proxy/src/bin/pg_sni_router.rs @@ -63,6 +63,7 @@ async fn main() -> anyhow::Result<()> { let _sentry_guard = init_sentry(Some(GIT_VERSION.into()), &[]); let args = cli().get_matches(); + let destination: String = args.get_one::("dest").unwrap().parse()?; // Configure TLS let tls_config: Arc = match ( @@ -103,8 +104,6 @@ async fn main() -> anyhow::Result<()> { _ => bail!("tls-key and tls-cert must be specified"), }; - let destination: String = args.get_one::("dest").unwrap().parse()?; - // Start listening for incoming client connections let proxy_address: SocketAddr = args.get_one::("listen").unwrap().parse()?; info!("Starting proxy on {proxy_address}"); @@ -225,7 +224,6 @@ async fn handle_client( let port = dest[2].parse::().context("invalid port")?; info!("destination: {:?}:{}", destination, port); - conn_cfg.host(destination.as_str()); conn_cfg.port(port);