@@ -32,8 +32,6 @@ pub mod refresh;
3232
3333use std:: path:: Path ;
3434
35- // Import discovery config types (used in ControlConfig struct)
36- use inferadb_control_types:: DiscoveryConfig ;
3735use inferadb_control_types:: error:: { Error , Result } ;
3836pub use refresh:: ConfigRefresher ;
3937use serde:: { Deserialize , Serialize } ;
@@ -109,12 +107,8 @@ pub struct ControlConfig {
109107 #[ serde( default ) ]
110108 pub limits : LimitsConfig ,
111109 #[ serde( default ) ]
112- pub mesh : MeshConfig ,
113- #[ serde( default ) ]
114110 pub webhook : WebhookConfig ,
115111 #[ serde( default ) ]
116- pub discovery : DiscoveryConfig ,
117- #[ serde( default ) ]
118112 pub frontend : FrontendConfig ,
119113}
120114
@@ -130,11 +124,6 @@ pub struct ListenConfig {
130124 /// Format: "host:port" (e.g., "127.0.0.1:9091")
131125 #[ serde( default = "default_grpc" ) ]
132126 pub grpc : String ,
133-
134- /// Service mesh / inter-service communication address (engine-to-control, JWKS endpoint)
135- /// Format: "host:port" (e.g., "0.0.0.0:9092")
136- #[ serde( default = "default_mesh" ) ]
137- pub mesh : String ,
138127}
139128
140129/// WebAuthn configuration for passkey authentication
@@ -231,35 +220,6 @@ impl Default for FrontendConfig {
231220 }
232221}
233222
234- /// Service mesh configuration for engine communication
235- ///
236- /// This configuration controls how control discovers and connects to
237- /// engine (policy service) instances. Both gRPC and HTTP internal endpoints are
238- /// derived from the same base URL with different ports.
239- #[ derive( Debug , Clone , Serialize , Deserialize ) ]
240- pub struct MeshConfig {
241- /// gRPC port for engine communication
242- /// Default: 8081
243- #[ serde( default = "default_mesh_grpc" ) ]
244- pub grpc : u16 ,
245-
246- /// Mesh port for internal communication (webhooks/JWKS)
247- /// Default: 8082
248- #[ serde( default = "default_mesh_port" ) ]
249- pub port : u16 ,
250-
251- /// Base URL (without port, used for discovery or direct connection)
252- /// e.g., "http://inferadb-engine.inferadb" for K8s or "http://localhost" for dev
253- #[ serde( default = "default_mesh_url" ) ]
254- pub url : String ,
255- }
256-
257- impl Default for MeshConfig {
258- fn default ( ) -> Self {
259- Self { grpc : default_mesh_grpc ( ) , port : default_mesh_port ( ) , url : default_mesh_url ( ) }
260- }
261- }
262-
263223/// Webhook configuration for cache invalidation
264224#[ derive( Debug , Clone , Serialize , Deserialize ) ]
265225pub struct WebhookConfig {
@@ -308,10 +268,6 @@ fn default_grpc() -> String {
308268 "127.0.0.1:9091" . to_string ( )
309269}
310270
311- fn default_mesh ( ) -> String {
312- "0.0.0.0:9092" . to_string ( ) // Control internal/mesh server port
313- }
314-
315271fn default_threads ( ) -> usize {
316272 num_cpus:: get ( )
317273}
@@ -348,18 +304,6 @@ fn default_password_reset_tokens_per_hour() -> u32 {
348304 3
349305}
350306
351- fn default_mesh_grpc ( ) -> u16 {
352- 8081 // Engine's public gRPC port
353- }
354-
355- fn default_mesh_port ( ) -> u16 {
356- 8082 // Engine's mesh/internal API port
357- }
358-
359- fn default_mesh_url ( ) -> String {
360- "http://localhost" . to_string ( ) // Default for development
361- }
362-
363307fn default_frontend_url ( ) -> String {
364308 "http://localhost:3000" . to_string ( )
365309}
@@ -383,11 +327,7 @@ impl Default for ControlConfig {
383327 logging : default_logging ( ) ,
384328 storage : default_storage ( ) ,
385329 ledger : LedgerConfig :: default ( ) ,
386- listen : ListenConfig {
387- http : default_http ( ) ,
388- grpc : default_grpc ( ) ,
389- mesh : default_mesh ( ) ,
390- } ,
330+ listen : ListenConfig { http : default_http ( ) , grpc : default_grpc ( ) } ,
391331 webauthn : WebAuthnConfig :: default ( ) ,
392332 key_file : default_key_file ( ) ,
393333 email : EmailConfig {
@@ -405,36 +345,14 @@ impl Default for ControlConfig {
405345 email_verification_tokens_per_hour : default_email_verification_tokens_per_hour ( ) ,
406346 password_reset_tokens_per_hour : default_password_reset_tokens_per_hour ( ) ,
407347 } ,
408- mesh : MeshConfig :: default ( ) ,
409348 pem : None ,
410349 webhook : WebhookConfig :: default ( ) ,
411- discovery : DiscoveryConfig :: default ( ) ,
412350 frontend : FrontendConfig :: default ( ) ,
413351 }
414352 }
415353}
416354
417355impl ControlConfig {
418- /// Get the effective gRPC URL for the engine service
419- ///
420- /// Combines `mesh.url` with `mesh.grpc`
421- /// to produce the full gRPC endpoint URL.
422- ///
423- /// Example: "http://localhost" + 8081 → "http://localhost:8081"
424- pub fn effective_grpc_url ( & self ) -> String {
425- format ! ( "{}:{}" , self . mesh. url, self . mesh. grpc)
426- }
427-
428- /// Get the effective mesh URL for the engine service
429- ///
430- /// Combines `mesh.url` with `mesh.port`
431- /// to produce the full mesh/internal API endpoint URL.
432- ///
433- /// Example: "http://localhost" + 8082 → "http://localhost:8082"
434- pub fn effective_mesh_url ( & self ) -> String {
435- format ! ( "{}:{}" , self . mesh. url, self . mesh. port)
436- }
437-
438356 /// Load configuration with layered precedence: defaults → file → env vars
439357 ///
440358 /// This function implements a proper configuration hierarchy:
@@ -517,9 +435,6 @@ impl ControlConfig {
517435 self . listen . grpc . parse :: < std:: net:: SocketAddr > ( ) . map_err ( |e| {
518436 Error :: Config ( format ! ( "listen.grpc '{}' is not valid: {}" , self . listen. grpc, e) )
519437 } ) ?;
520- self . listen . mesh . parse :: < std:: net:: SocketAddr > ( ) . map_err ( |e| {
521- Error :: Config ( format ! ( "listen.mesh '{}' is not valid: {}" , self . listen. mesh, e) )
522- } ) ?;
523438
524439 // Validate storage backend
525440 match self . storage . as_str ( ) {
@@ -605,14 +520,6 @@ impl ControlConfig {
605520 ) ) ;
606521 }
607522
608- // Validate mesh.url format
609- if !self . mesh . url . starts_with ( "http://" ) && !self . mesh . url . starts_with ( "https://" ) {
610- return Err ( Error :: Config ( "mesh.url must start with http:// or https://" . to_string ( ) ) ) ;
611- }
612- if self . mesh . url . ends_with ( '/' ) {
613- return Err ( Error :: Config ( "mesh.url must not end with trailing slash" . to_string ( ) ) ) ;
614- }
615-
616523 Ok ( ( ) )
617524 }
618525
@@ -658,7 +565,6 @@ mod tests {
658565 fn test_config_defaults ( ) {
659566 assert_eq ! ( default_http( ) , "127.0.0.1:9090" ) ;
660567 assert_eq ! ( default_grpc( ) , "127.0.0.1:9091" ) ;
661- assert_eq ! ( default_mesh( ) , "0.0.0.0:9092" ) ;
662568 assert_eq ! ( default_storage( ) , "ledger" ) ; // Ledger is now the default
663569 assert_eq ! ( default_webauthn_party( ) , "localhost" ) ;
664570 assert_eq ! ( default_webauthn_origin( ) , "http://localhost:3000" ) ;
@@ -695,18 +601,4 @@ mod tests {
695601 config. ledger . namespace_id = Some ( 1 ) ;
696602 assert ! ( config. validate( ) . is_ok( ) ) ;
697603 }
698-
699- #[ test]
700- fn test_effective_urls ( ) {
701- let config = ControlConfig :: default ( ) ;
702- assert_eq ! ( config. effective_grpc_url( ) , "http://localhost:8081" ) ;
703- assert_eq ! ( config. effective_mesh_url( ) , "http://localhost:8082" ) ;
704-
705- let mut config = ControlConfig :: default ( ) ;
706- config. mesh . url = "http://inferadb-engine.inferadb" . to_string ( ) ;
707- config. mesh . grpc = 9000 ;
708- config. mesh . port = 9191 ;
709- assert_eq ! ( config. effective_grpc_url( ) , "http://inferadb-engine.inferadb:9000" ) ;
710- assert_eq ! ( config. effective_mesh_url( ) , "http://inferadb-engine.inferadb:9191" ) ;
711- }
712604}
0 commit comments