Skip to content

Commit

Permalink
fix(registry): only bind if MAILI_BIND env var is set
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell committed Feb 10, 2025
1 parent b9d8d2e commit 50c7deb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/registry/Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ default:

# Generate file bindings
bind:
cargo build
MAILI_BIND=true cargo build

# Update the `superchain-registry` git submodule source
source:
Expand Down
12 changes: 7 additions & 5 deletions crates/registry/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
use maili_genesis::{ChainConfig, Superchain, SuperchainConfig, Superchains};

fn main() {
// Get the directory of this file from the environment
let src_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();

// Check if the filesystem is read-only
if std::path::Path::new(&src_dir).metadata().unwrap().permissions().readonly() {
// If the `MAILI_BIND` environment variable is _not_ set, then return early.
let maili_bind: bool =
std::env::var("MAILI_BIND").unwrap_or_else(|_| "false".to_string()) == "true";
if !maili_bind {
return;
}

// Get the directory of this file from the environment
let src_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();

// Check if the `superchain-registry` directory exists
let superchain_registry = format!("{}/superchain-registry", src_dir);
if !std::path::Path::new(&superchain_registry).exists() {
Expand Down

0 comments on commit 50c7deb

Please sign in to comment.