@@ -400,7 +400,7 @@ pub trait ConfigObj: DIService {
400400
401401 fn long_term_job_runners_count ( & self ) -> usize ;
402402
403- fn bind_address ( & self ) -> & Option < String > ;
403+ fn mysql_bind_address ( & self ) -> & Option < String > ;
404404
405405 fn status_bind_address ( & self ) -> & Option < String > ;
406406
@@ -576,7 +576,7 @@ pub struct ConfigObjImpl {
576576 pub select_worker_idle_timeout : u64 ,
577577 pub job_runners_count : usize ,
578578 pub long_term_job_runners_count : usize ,
579- pub bind_address : Option < String > ,
579+ pub mysql_bind_address : Option < String > ,
580580 pub status_bind_address : Option < String > ,
581581 pub http_bind_address : Option < String > ,
582582 pub query_timeout : u64 ,
@@ -734,8 +734,8 @@ impl ConfigObj for ConfigObjImpl {
734734 self . long_term_job_runners_count
735735 }
736736
737- fn bind_address ( & self ) -> & Option < String > {
738- & self . bind_address
737+ fn mysql_bind_address ( & self ) -> & Option < String > {
738+ & self . mysql_bind_address
739739 }
740740
741741 fn status_bind_address ( & self ) -> & Option < String > {
@@ -1329,7 +1329,7 @@ impl Config {
13291329 Some ( 2 * 60 * 60 ) ,
13301330 None ,
13311331 ) ,
1332- bind_address : Some (
1332+ mysql_bind_address : Some (
13331333 env:: var ( "CUBESTORE_BIND_ADDR" )
13341334 . ok ( )
13351335 . unwrap_or ( format ! ( "0.0.0.0:{}" , env_parse( "CUBESTORE_PORT" , 3306 ) ) ) ,
@@ -1621,7 +1621,7 @@ impl Config {
16211621 select_worker_idle_timeout : 600 ,
16221622 job_runners_count : 4 ,
16231623 long_term_job_runners_count : 8 ,
1624- bind_address : None ,
1624+ mysql_bind_address : None ,
16251625 status_bind_address : None ,
16261626 http_bind_address : None ,
16271627 query_timeout,
@@ -1842,11 +1842,6 @@ impl Config {
18421842 }
18431843
18441844 pub async fn configure_remote_fs ( & self ) {
1845- let config_obj_to_register = self . config_obj . clone ( ) ;
1846- self . injector
1847- . register_typed :: < dyn ConfigObj , _ , _ , _ > ( async move |_| config_obj_to_register)
1848- . await ;
1849-
18501845 match & self . config_obj . store_provider {
18511846 FileStoreProvider :: Filesystem { remote_dir } => {
18521847 let remote_dir = remote_dir. clone ( ) ;
@@ -2320,7 +2315,7 @@ impl Config {
23202315 } )
23212316 . await ;
23222317
2323- if self . config_obj . bind_address ( ) . is_some ( ) {
2318+ if let Some ( mysql_bind_address ) = self . config_obj . mysql_bind_address ( ) . clone ( ) {
23242319 self . injector
23252320 . register_typed :: < dyn SqlAuthService , _ , _ , _ > ( async move |_| {
23262321 Arc :: new ( SqlAuthDefaultImpl )
@@ -2330,23 +2325,20 @@ impl Config {
23302325 self . injector
23312326 . register_typed :: < MySqlServer , _ , _ , _ > ( async move |i| {
23322327 MySqlServer :: new (
2333- i. get_service_typed :: < dyn ConfigObj > ( )
2334- . await
2335- . bind_address ( )
2336- . as_ref ( )
2337- . unwrap ( )
2338- . to_string ( ) ,
2328+ mysql_bind_address,
23392329 i. get_service_typed ( ) . await ,
23402330 i. get_service_typed ( ) . await ,
23412331 )
23422332 } )
23432333 . await ;
2334+ }
23442335
2336+ if let Some ( http_bind_address) = self . config_obj . http_bind_address ( ) . clone ( ) {
23452337 self . injector
23462338 . register_typed :: < HttpServer , _ , _ , _ > ( async move |i| {
23472339 let config = i. get_service_typed :: < dyn ConfigObj > ( ) . await ;
23482340 HttpServer :: new (
2349- config . http_bind_address ( ) . as_ref ( ) . unwrap ( ) . to_string ( ) ,
2341+ http_bind_address,
23502342 i. get_service_typed ( ) . await ,
23512343 i. get_service_typed ( ) . await ,
23522344 Duration :: from_secs ( config. check_ws_orphaned_messages_interval_secs ( ) ) ,
@@ -2370,6 +2362,11 @@ impl Config {
23702362 }
23712363
23722364 pub async fn configure_injector ( & self ) {
2365+ let config_obj_to_register = self . config_obj . clone ( ) ;
2366+ self . injector
2367+ . register_typed :: < dyn ConfigObj , _ , _ , _ > ( async move |_| config_obj_to_register)
2368+ . await ;
2369+
23732370 self . configure_remote_fs ( ) . await ;
23742371 self . configure_cache_store ( ) . await ;
23752372 self . configure_meta_store ( ) . await ;
0 commit comments