Skip to content

Commit

Permalink
Move station_id constraint assertion to run_js_module
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickNercessian committed May 3, 2024
1 parent c4dddac commit 7bc19e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 0 additions & 7 deletions daemon/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,6 @@ async fn run(config: CliArgs) -> Result<RunOutput> {
rng_seed: None,
};

if !Regex::new(r"^[0-9a-fA-F]{88}$")
.unwrap()
.is_match(&runtime_config.station_id)
{
return Err(anyhow!("Invalid station_id format"));
}

// TODO: handle module exit and restart it
// https://github.com/filecoin-station/zinnia/issues/146
log::info!("Starting module {main_module}");
Expand Down
7 changes: 7 additions & 0 deletions runtime/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ pub async fn run_js_module(
module_specifier: &ModuleSpecifier,
bootstrap_options: &BootstrapOptions,
) -> Result<(), AnyError> {
if !Regex::new(r"^[0-9a-fA-F]{88}$")
.unwrap()
.is_match(&bootstrap_options.station_id)
{
return Err(anyhow!("Invalid station_id format"));
}

let blob_store = Arc::new(BlobStore::default());
let reporter = Rc::clone(&bootstrap_options.reporter);

Expand Down

0 comments on commit 7bc19e3

Please sign in to comment.