33use std:: {
44 collections:: HashMap ,
55 net:: { Ipv4Addr , SocketAddr } ,
6+ path:: PathBuf ,
67 sync:: Arc ,
78} ;
89
@@ -242,8 +243,11 @@ fn default_pbs() -> String {
242243}
243244
244245/// Loads the default pbs config, i.e. with no signer client or custom data
245- pub async fn load_pbs_config ( ) -> Result < PbsModuleConfig > {
246- let config = CommitBoostConfig :: from_env_path ( ) ?;
246+ pub async fn load_pbs_config ( config_path : Option < PathBuf > ) -> Result < ( PbsModuleConfig , PathBuf ) > {
247+ let ( config, config_path) = match config_path {
248+ Some ( path) => ( CommitBoostConfig :: from_file ( & path) ?, path) ,
249+ None => CommitBoostConfig :: from_env_path ( ) ?,
250+ } ;
247251 config. validate ( ) . await ?;
248252
249253 // Make sure relays isn't empty - since the config is still technically valid if
@@ -295,16 +299,19 @@ pub async fn load_pbs_config() -> Result<PbsModuleConfig> {
295299
296300 let all_relays = all_relays. into_values ( ) . collect ( ) ;
297301
298- Ok ( PbsModuleConfig {
299- chain : config. chain ,
300- endpoint,
301- pbs_config : Arc :: new ( config. pbs . pbs_config ) ,
302- relays : relay_clients,
303- all_relays,
304- signer_client : None ,
305- registry_muxes,
306- mux_lookup,
307- } )
302+ Ok ( (
303+ PbsModuleConfig {
304+ chain : config. chain ,
305+ endpoint,
306+ pbs_config : Arc :: new ( config. pbs . pbs_config ) ,
307+ relays : relay_clients,
308+ all_relays,
309+ signer_client : None ,
310+ registry_muxes,
311+ mux_lookup,
312+ } ,
313+ config_path,
314+ ) )
308315}
309316
310317/// Loads a custom pbs config, i.e. with signer client and/or custom data
@@ -326,7 +333,7 @@ pub async fn load_pbs_custom_config<T: DeserializeOwned>() -> Result<(PbsModuleC
326333 }
327334
328335 // load module config including the extra data (if any)
329- let cb_config: StubConfig < T > = load_file_from_env ( CONFIG_ENV ) ?;
336+ let ( cb_config, _ ) : ( StubConfig < T > , _ ) = load_file_from_env ( CONFIG_ENV ) ?;
330337 cb_config. pbs . static_config . pbs_config . validate ( cb_config. chain ) . await ?;
331338
332339 // use endpoint from env if set, otherwise use default host and port
0 commit comments