Skip to content

Commit

Permalink
refactor: provide usage when payload sha is missing
Browse files Browse the repository at this point in the history
Signed-off-by: Joonas Bergius <[email protected]>
  • Loading branch information
joonas committed Aug 27, 2024
1 parent 19cdbba commit 6c2346e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/injector/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::io;
use std::io::Read;
use std::io::Write;
use std::path::PathBuf;
use std::process::exit;

use axum::{
body::Body,
Expand Down Expand Up @@ -257,14 +258,15 @@ async fn handle_get_digest(tag: String) -> Response {
#[tokio::main(flavor = "current_thread")]
async fn main() {
let args: Vec<String> = env::args().collect();
if args.len() != 2 {
println!("Usage: {} <sha256sum>", args[0]);
exit(1);
}

println!("unpacking: {}", args[1]);
let payload_sha = &args[1];

unpack(payload_sha);
unpack(&args[1]);

let listener = tokio::net::TcpListener::bind("0.0.0.0:5000").await.unwrap();
println!("listening on {}", listener.local_addr().unwrap());
axum::serve(listener, start_seed_registry()).await.unwrap();
println!("Usage: {} <sha256sum>", args[1]);
}

0 comments on commit 6c2346e

Please sign in to comment.