From b7c74069db186c900bb1fd94b9816924e31b976d Mon Sep 17 00:00:00 2001 From: Leo Nash Date: Wed, 4 Feb 2026 20:53:16 +0000 Subject: [PATCH 1/2] Relax validation on the postgres service address setting We previously parsed the postgres service address setting into a `std::net::SocketAddr`, which was overly restrictive, and prevented the use of hostnames for that setting. The postgres service address is logged on startup, so the user can check that the service address is correctly configured in case of a failure to connect to the postgres database on startup. --- rust/server/src/util/config.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/rust/server/src/util/config.rs b/rust/server/src/util/config.rs index 2252653..3b5d44e 100644 --- a/rust/server/src/util/config.rs +++ b/rust/server/src/util/config.rs @@ -39,7 +39,7 @@ struct JwtAuthConfig { struct PostgreSQLConfig { username: Option, password: Option, - address: Option, + address: Option, default_database: Option, vss_database: Option, tls: Option, @@ -146,13 +146,7 @@ pub(crate) fn load_configuration(config_file_path: Option<&str>) -> Result = read_env(PSQL_ADDR_VAR)? - .map(|address| { - address.parse().map_err(|e| { - format!("Unable to parse the postgresql address environment variable: {}", e) - }) - }) - .transpose()?; + let address_env: Option = read_env(PSQL_ADDR_VAR)?; let default_db_env = read_env(PSQL_DB_VAR)?; let vss_db_env = read_env(PSQL_VSS_DB_VAR)?; let tls_config_env = read_env(PSQL_TLS_VAR)?; From 945b348377fff82eff595fbfdb8bb8ac07f26008 Mon Sep 17 00:00:00 2001 From: Leo Nash Date: Mon, 9 Feb 2026 07:16:11 +0000 Subject: [PATCH 2/2] Relax validation on the bind address setting We previously parsed the bind address setting into a `std::net::SocketAddr`, which was overly restrictive, and prevented the use of hostnames for that setting. In case of a failure to bind to the specified address, we make sure to report the bind address in the error message so the user understands which address we tried to bind to. --- rust/server/src/main.rs | 2 +- rust/server/src/util/config.rs | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/rust/server/src/main.rs b/rust/server/src/main.rs index 16515c4..2f9b6a2 100644 --- a/rust/server/src/main.rs +++ b/rust/server/src/main.rs @@ -151,7 +151,7 @@ fn main() { }; let rest_svc_listener = TcpListener::bind(&config.bind_address).await.unwrap_or_else(|e| { - error!("Failed to bind listening port: {}", e); + error!("Failed to bind to address {}: {}", config.bind_address, e); std::process::exit(-1); }); info!("Listening for incoming connections on {}{}", config.bind_address, crate::vss_service::BASE_PATH_PREFIX); diff --git a/rust/server/src/util/config.rs b/rust/server/src/util/config.rs index 3b5d44e..6933435 100644 --- a/rust/server/src/util/config.rs +++ b/rust/server/src/util/config.rs @@ -27,7 +27,7 @@ struct TomlConfig { #[derive(Deserialize)] struct ServerConfig { - bind_address: Option, + bind_address: Option, } #[derive(Deserialize)] @@ -58,7 +58,7 @@ struct LogConfig { // Encapsulates the result of reading both the environment variables and the config file. pub(crate) struct Configuration { - pub(crate) bind_address: SocketAddr, + pub(crate) bind_address: String, pub(crate) rsa_pem: Option, pub(crate) postgresql_prefix: String, pub(crate) default_db: String, @@ -99,13 +99,7 @@ pub(crate) fn load_configuration(config_file_path: Option<&str>) -> Result TomlConfig::default(), // All fields are set to `None` }; - let bind_address_env = read_env(BIND_ADDR_VAR)? - .map(|addr| { - addr.parse().map_err(|e| { - format!("Unable to parse the bind address environment variable: {}", e) - }) - }) - .transpose()?; + let bind_address_env = read_env(BIND_ADDR_VAR)?; let bind_address = read_config( bind_address_env, server_config.and_then(|c| c.bind_address),