@@ -122,20 +122,19 @@ pub async fn handle_docker_init(config_path: PathBuf, output_dir: PathBuf) -> Re
122122 module_envs. insert ( key, val) ;
123123 }
124124
125- if let Some ( metrics_config) = & cb_config. metrics
126- && metrics_config. enabled {
127- let host_endpoint =
128- SocketAddr :: from ( ( metrics_config. host , metrics_port) ) ;
129- ports. push ( format ! ( "{host_endpoint}:{metrics_port}" ) ) ;
130- warnings. push ( format ! (
131- "{module_cid} has an exported port on {metrics_port}"
132- ) ) ;
133- targets. push ( format ! ( "{host_endpoint}" ) ) ;
134- let ( key, val) = get_env_uval ( METRICS_PORT_ENV , metrics_port as u64 ) ;
135- module_envs. insert ( key, val) ;
136-
137- metrics_port += 1 ;
138- }
125+ if let Some ( metrics_config) = & cb_config. metrics &&
126+ metrics_config. enabled
127+ {
128+ let host_endpoint = SocketAddr :: from ( ( metrics_config. host , metrics_port) ) ;
129+ ports. push ( format ! ( "{host_endpoint}:{metrics_port}" ) ) ;
130+ warnings
131+ . push ( format ! ( "{module_cid} has an exported port on {metrics_port}" ) ) ;
132+ targets. push ( format ! ( "{host_endpoint}" ) ) ;
133+ let ( key, val) = get_env_uval ( METRICS_PORT_ENV , metrics_port as u64 ) ;
134+ module_envs. insert ( key, val) ;
135+
136+ metrics_port += 1 ;
137+ }
139138
140139 if log_to_file {
141140 let ( key, val) = get_env_val ( LOGS_DIR_ENV , LOGS_DIR_DEFAULT ) ;
@@ -209,17 +208,18 @@ pub async fn handle_docker_init(config_path: PathBuf, output_dir: PathBuf) -> Re
209208 if let Some ( ( key, val) ) = chain_spec_env. clone ( ) {
210209 pbs_envs. insert ( key, val) ;
211210 }
212- if let Some ( metrics_config) = & cb_config. metrics
213- && metrics_config. enabled {
214- let host_endpoint = SocketAddr :: from ( ( metrics_config. host , metrics_port) ) ;
215- ports. push ( format ! ( "{host_endpoint}:{metrics_port}" ) ) ;
216- warnings. push ( format ! ( "cb_pbs has an exported port on {metrics_port}" ) ) ;
217- targets. push ( format ! ( "{host_endpoint}" ) ) ;
218- let ( key, val) = get_env_uval ( METRICS_PORT_ENV , metrics_port as u64 ) ;
219- pbs_envs. insert ( key, val) ;
220-
221- metrics_port += 1 ;
222- }
211+ if let Some ( metrics_config) = & cb_config. metrics &&
212+ metrics_config. enabled
213+ {
214+ let host_endpoint = SocketAddr :: from ( ( metrics_config. host , metrics_port) ) ;
215+ ports. push ( format ! ( "{host_endpoint}:{metrics_port}" ) ) ;
216+ warnings. push ( format ! ( "cb_pbs has an exported port on {metrics_port}" ) ) ;
217+ targets. push ( format ! ( "{host_endpoint}" ) ) ;
218+ let ( key, val) = get_env_uval ( METRICS_PORT_ENV , metrics_port as u64 ) ;
219+ pbs_envs. insert ( key, val) ;
220+
221+ metrics_port += 1 ;
222+ }
223223 if log_to_file {
224224 let ( key, val) = get_env_val ( LOGS_DIR_ENV , LOGS_DIR_DEFAULT ) ;
225225 pbs_envs. insert ( key, val) ;
@@ -284,16 +284,16 @@ pub async fn handle_docker_init(config_path: PathBuf, output_dir: PathBuf) -> Re
284284 if let Some ( ( key, val) ) = chain_spec_env. clone ( ) {
285285 signer_envs. insert ( key, val) ;
286286 }
287- if let Some ( metrics_config) = & cb_config. metrics
288- && metrics_config. enabled {
289- let host_endpoint = SocketAddr :: from ( ( metrics_config . host , metrics_port ) ) ;
290- ports . push ( format ! ( "{host_endpoint}:{ metrics_port}" ) ) ;
291- warnings
292- . push ( format ! ( "cb_signer has an exported port on {metrics_port}" ) ) ;
293- targets. push ( format ! ( "{host_endpoint}" ) ) ;
294- let ( key, val) = get_env_uval ( METRICS_PORT_ENV , metrics_port as u64 ) ;
295- signer_envs. insert ( key, val) ;
296- }
287+ if let Some ( metrics_config) = & cb_config. metrics &&
288+ metrics_config. enabled
289+ {
290+ let host_endpoint = SocketAddr :: from ( ( metrics_config . host , metrics_port) ) ;
291+ ports . push ( format ! ( "{host_endpoint}:{metrics_port}" ) ) ;
292+ warnings . push ( format ! ( "cb_signer has an exported port on {metrics_port}" ) ) ;
293+ targets. push ( format ! ( "{host_endpoint}" ) ) ;
294+ let ( key, val) = get_env_uval ( METRICS_PORT_ENV , metrics_port as u64 ) ;
295+ signer_envs. insert ( key, val) ;
296+ }
297297 if log_to_file {
298298 let ( key, val) = get_env_val ( LOGS_DIR_ENV , LOGS_DIR_DEFAULT ) ;
299299 signer_envs. insert ( key, val) ;
@@ -418,16 +418,16 @@ pub async fn handle_docker_init(config_path: PathBuf, output_dir: PathBuf) -> Re
418418 if let Some ( ( key, val) ) = chain_spec_env. clone ( ) {
419419 signer_envs. insert ( key, val) ;
420420 }
421- if let Some ( metrics_config) = & cb_config. metrics
422- && metrics_config. enabled {
423- let host_endpoint = SocketAddr :: from ( ( metrics_config . host , metrics_port ) ) ;
424- ports . push ( format ! ( "{host_endpoint}:{ metrics_port}" ) ) ;
425- warnings
426- . push ( format ! ( "cb_signer has an exported port on {metrics_port}" ) ) ;
427- targets. push ( format ! ( "{host_endpoint}" ) ) ;
428- let ( key, val) = get_env_uval ( METRICS_PORT_ENV , metrics_port as u64 ) ;
429- signer_envs. insert ( key, val) ;
430- }
421+ if let Some ( metrics_config) = & cb_config. metrics &&
422+ metrics_config. enabled
423+ {
424+ let host_endpoint = SocketAddr :: from ( ( metrics_config . host , metrics_port) ) ;
425+ ports . push ( format ! ( "{host_endpoint}:{metrics_port}" ) ) ;
426+ warnings . push ( format ! ( "cb_signer has an exported port on {metrics_port}" ) ) ;
427+ targets. push ( format ! ( "{host_endpoint}" ) ) ;
428+ let ( key, val) = get_env_uval ( METRICS_PORT_ENV , metrics_port as u64 ) ;
429+ signer_envs. insert ( key, val) ;
430+ }
431431 if log_to_file {
432432 let ( key, val) = get_env_val ( LOGS_DIR_ENV , LOGS_DIR_DEFAULT ) ;
433433 signer_envs. insert ( key, val) ;
@@ -570,12 +570,8 @@ pub async fn handle_docker_init(config_path: PathBuf, output_dir: PathBuf) -> Re
570570 println ! ( "Env file written to: {env_path:?}" ) ;
571571
572572 println ! ( ) ;
573- println ! (
574- "Run with:\n \t docker compose --env-file {env_path:?} -f {compose_path:?} up -d"
575- ) ;
576- println ! (
577- "Stop with:\n \t docker compose --env-file {env_path:?} -f {compose_path:?} down"
578- ) ;
573+ println ! ( "Run with:\n \t docker compose --env-file {env_path:?} -f {compose_path:?} up -d" ) ;
574+ println ! ( "Stop with:\n \t docker compose --env-file {env_path:?} -f {compose_path:?} down" ) ;
579575 }
580576
581577 Ok ( ( ) )
0 commit comments