Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional builder jwt token param #21

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ struct Args {
#[arg(long, env)]
jwt_path: Option<PathBuf>,

/// JWT token for authentication for the builder
#[arg(long, env)]
builder_jwt_token: Option<String>,

/// Path to the JWT secret file for the builder
#[arg(long, env)]
builder_jwt_path: Option<PathBuf>,

/// URL of the local l2 execution engine
#[arg(long, env)]
l2_url: String,
Expand Down Expand Up @@ -91,11 +99,21 @@ async fn main() -> Result<()> {
}
};

let builder_jwt_secret = match (args.builder_jwt_path, args.builder_jwt_token) {
(Some(file), None) => {
JwtSecret::from_file(&file).map_err(|e| Error::InvalidArgs(e.to_string()))?
}
(None, Some(secret)) => {
JwtSecret::from_hex(secret).map_err(|e| Error::InvalidArgs(e.to_string()))?
}
_ => jwt_secret,
};

// Initialize the l2 client
let l2_client = create_client(&args.l2_url, jwt_secret)?;

// Initialize the builder client
let builder_client = create_client(&args.builder_url, jwt_secret)?;
let builder_client = create_client(&args.builder_url, builder_jwt_secret)?;

let eth_engine_api = EthEngineApi::new(
Arc::new(l2_client),
Expand Down
Loading