diff --git a/src/main.rs b/src/main.rs index b2b1d40..f93ed31 100644 --- a/src/main.rs +++ b/src/main.rs @@ -68,6 +68,11 @@ struct Args { #[clap(long, default_value_t = 15)] timeout: u64, + /// Command to execute, normally path to `enarx` binary. + /// This command will be executed as: ` run --wasmcfgfile ` + #[clap(long, default_value = "enarx")] + command: String, + /// OpenID Connect issuer URL. #[clap(long)] oidc_issuer: Url, @@ -87,6 +92,7 @@ async fn main() -> anyhow::Result<()> { addr, jobs, timeout, + command, oidc_issuer: _, oidc_client: _, oidc_secret: _, @@ -137,7 +143,7 @@ async fn main() -> anyhow::Result<()> { .route("/:uuid/err", post(uuid_err_post)) .route( "/", - get(root_get).post(move |mp| root_post(mp, timeout, jobs)), + get(root_get).post(move |mp| root_post(mp, command, timeout, jobs)), ) .layer(TraceLayer::new_for_http()); @@ -151,6 +157,7 @@ async fn root_get() -> Html<&'static str> { async fn root_post( mut multipart: Multipart, + command: String, timeout: u64, jobs: usize, ) -> Result { @@ -227,7 +234,7 @@ async fn root_post( let wasm = wasm.ok_or(StatusCode::BAD_REQUEST)?; let toml = toml.ok_or(StatusCode::BAD_REQUEST)?; let uuid = Uuid::new_v4(); - let exec = Command::new("enarx") + let exec = Command::new(command) .arg("run") .arg("--wasmcfgfile") .arg(toml.path())