diff --git a/config/config.example.toml b/config/config.example.toml index d4c23a6b529..f6359a5e9ab 100644 --- a/config/config.example.toml +++ b/config/config.example.toml @@ -1132,8 +1132,7 @@ static_routing_enabled = true # Enable or disable Open Router for stat url = "http://localhost:8080" # Open Router URL [grpc_client.unified_connector_service] -host = "localhost" # Unified Connector Service Client Host -port = 8000 # Unified Connector Service Client Port +base_url = "http://localhost:8000" # Unified Connector Service Base URL connection_timeout = 10 # Connection Timeout Duration in Seconds [billing_connectors_invoice_sync] diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml index 23ff9f16e70..49ef2a0b803 100644 --- a/config/deployments/env_specific.toml +++ b/config/deployments/env_specific.toml @@ -379,8 +379,7 @@ merchant_ids = "merchant_ids" # Comma-separated list of allowed mercha connector_names = "connector_names" # Comma-separated list of allowed connector names [grpc_client.unified_connector_service] -host = "localhost" # Unified Connector Service Client Host -port = 8000 # Unified Connector Service Client Port +base_url = "http://localhost:8000" # Unified Connector Service Base URL connection_timeout = 10 # Connection Timeout Duration in Seconds [chat] diff --git a/config/development.toml b/config/development.toml index 047afe11795..39ff47055f4 100644 --- a/config/development.toml +++ b/config/development.toml @@ -1232,8 +1232,7 @@ static_routing_enabled = false url = "http://localhost:8080" [grpc_client.unified_connector_service] -host = "localhost" -port = 8000 +base_url = "http://localhost:8000" connection_timeout = 10 [revenue_recovery] diff --git a/crates/external_services/src/grpc_client/unified_connector_service.rs b/crates/external_services/src/grpc_client/unified_connector_service.rs index bac66a3bb50..bc3b8ca94ed 100644 --- a/crates/external_services/src/grpc_client/unified_connector_service.rs +++ b/crates/external_services/src/grpc_client/unified_connector_service.rs @@ -1,4 +1,4 @@ -use common_utils::{consts as common_utils_consts, errors::CustomResult}; +use common_utils::{consts as common_utils_consts, errors::CustomResult, types::Url}; use error_stack::ResultExt; use masking::{PeekInterface, Secret}; use router_env::logger; @@ -110,11 +110,8 @@ pub struct UnifiedConnectorServiceClient { /// Contains the Unified Connector Service Client config #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] pub struct UnifiedConnectorServiceClientConfig { - /// Host for the gRPC Client - pub host: String, - - /// Port of the gRPC Client - pub port: u16, + /// Base URL of the gRPC Server + pub base_url: Url, /// Contains the connection timeout duration in seconds pub connection_timeout: u64, @@ -147,13 +144,11 @@ impl UnifiedConnectorServiceClient { pub async fn build_connections(config: &GrpcClientSettings) -> Option { match &config.unified_connector_service { Some(unified_connector_service_client_config) => { - let uri_str = format!( - "https://{}:{}", - unified_connector_service_client_config.host, - unified_connector_service_client_config.port - ); - - let uri: Uri = match uri_str.parse() { + let uri: Uri = match unified_connector_service_client_config + .base_url + .get_string_repr() + .parse() + { Ok(parsed_uri) => parsed_uri, Err(err) => { logger::error!(error = ?err, "Failed to parse URI for Unified Connector Service");