@@ -31,8 +31,10 @@ pub async fn config(
3131) -> GlobalResult < types:: TraefikConfigResponseNullified > {
3232 ctx. auth ( ) . token ( & token) . await ?;
3333
34+ let mut config = types:: TraefikConfigResponse :: default ( ) ;
35+
3436 // Fetch configs and catch any errors
35- let config = build_cdn ( & ctx) . await ?;
37+ build_cdn ( & ctx, & mut config ) . await ?;
3638
3739 // tracing::info!(
3840 // http_services = ?config.http.services.len(),
@@ -47,6 +49,13 @@ pub async fn config(
4749 // "traefik config"
4850 // );
4951
52+ tracing:: info!(
53+ services = ?config. http. services. len( ) ,
54+ routers = config. http. routers. len( ) ,
55+ middlewares = ?config. http. middlewares. len( ) ,
56+ "cdn traefik config"
57+ ) ;
58+
5059 Ok ( types:: TraefikConfigResponseNullified {
5160 http : config. http . nullified ( ) ,
5261 tcp : config. tcp . nullified ( ) ,
@@ -56,16 +65,18 @@ pub async fn config(
5665
5766/// Builds configuration for CDN routes.
5867#[ tracing:: instrument( skip( ctx) ) ]
59- pub async fn build_cdn ( ctx : & Ctx < Auth > ) -> GlobalResult < types:: TraefikConfigResponse > {
60- let mut config = types:: TraefikConfigResponse :: default ( ) ;
68+ pub async fn build_cdn (
69+ ctx : & Ctx < Auth > ,
70+ config : & mut types:: TraefikConfigResponse ,
71+ ) -> GlobalResult < ( ) > {
6172 let s3_client = s3_util:: Client :: from_env ( "bucket-cdn" ) . await ?;
6273
6374 let redis_cdn = ctx. op_ctx ( ) . redis_cdn ( ) . await ?;
6475 let cdn_fetch = fetch_cdn ( redis_cdn) . await ?;
6576
6677 // Process namespaces
6778 for ns in & cdn_fetch {
68- let register_res = register_namespace ( ns, & mut config, & s3_client) ;
79+ let register_res = register_namespace ( ns, config, & s3_client) ;
6980 match register_res {
7081 Ok ( _) => { }
7182 Err ( err) => tracing:: error!( ?err, ?ns, "failed to register namespace route" ) ,
@@ -149,14 +160,7 @@ pub async fn build_cdn(ctx: &Ctx<Auth>) -> GlobalResult<types::TraefikConfigResp
149160 } ,
150161 ) ;
151162
152- tracing:: info!(
153- services = ?config. http. services. len( ) ,
154- routers = config. http. routers. len( ) ,
155- middlewares = ?config. http. middlewares. len( ) ,
156- "cdn traefik config"
157- ) ;
158-
159- Ok ( config)
163+ Ok ( ( ) )
160164}
161165
162166#[ tracing:: instrument( skip( redis_cdn) ) ]
0 commit comments