Skip to content

Commit e1371e4

Browse files
committed
load keys to check
1 parent 3550645 commit e1371e4

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

  • crates/common/src/config

crates/common/src/config/mux.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,24 +127,16 @@ impl MuxConfig {
127127

128128
match loader {
129129
MuxKeysLoader::File(path_buf) => {
130-
ensure!(
131-
path_buf.try_exists().is_ok_and(|exists| exists),
132-
"path doesn't exist: {:?}",
133-
path_buf
134-
);
135-
136-
ensure!(
137-
path_buf.extension().is_some_and(|ext| ext == "json"),
138-
"file doesn't have a .json extension: {:?}",
139-
path_buf
140-
);
141-
142130
let Some(path) = path_buf.to_str() else {
143131
bail!("invalid path: {:?}", path_buf);
144132
};
145133

146-
let internal_path = get_mux_path(&self.id);
134+
let file = load_file(path)?;
135+
// make sure we can load the pubkeys correctly
136+
let _: Vec<BlsPublicKey> =
137+
serde_json::from_str(&file).wrap_err("failed to parse mux keys file")?;
147138

139+
let internal_path = get_mux_path(&self.id);
148140
Ok(Some((get_mux_env(&self.id), path.to_owned(), internal_path)))
149141
}
150142
MuxKeysLoader::HTTP { .. } => Ok(None),

0 commit comments

Comments
 (0)