Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion crates/kit/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ fn install_tracing() {
use tracing_subscriber::prelude::*;
use tracing_subscriber::EnvFilter;

let fmt_layer = fmt::layer().with_target(false).with_writer(std::io::stderr);
let format = fmt::format().without_time().with_target(false).compact();

let fmt_layer = fmt::layer()
.event_format(format)
.with_writer(std::io::stderr);
Comment on lines +157 to +161

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since the format variable is only used once, you could consider inlining its definition directly into the .event_format() call. This would make the fmt_layer configuration more concise and express it as a single fluent chain of calls, which is a common pattern when using builders in Rust.

Suggested change
let format = fmt::format().without_time().with_target(false).compact();
let fmt_layer = fmt::layer()
.event_format(format)
.with_writer(std::io::stderr);
let fmt_layer = fmt::layer()
.event_format(fmt::format().without_time().with_target(false).compact())
.with_writer(std::io::stderr);

let filter_layer = EnvFilter::try_from_default_env()
.or_else(|_| EnvFilter::try_new("info"))
.unwrap();
Expand Down
15 changes: 10 additions & 5 deletions crates/kit/src/run_ephemeral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ pub struct CommonPodmanOptions {
help = "Add metadata to the container in key=value form"
)]
pub label: Vec<String>,

#[clap(
long = "env",
short = 'e',
help = "Set environment variables in the container (key=value)"
)]
pub env: Vec<String>,
}

/// Common VM configuration options for hardware, networking, and features.
Expand Down Expand Up @@ -400,6 +407,9 @@ fn prepare_run_command_with_temp(
if opts.podman.detach {
cmd.arg("-d");
}
for env in opts.podman.env.iter() {
cmd.arg(format!("--env={env}"));
}

let vhost_dev = Utf8Path::new(qemu::VHOST_VSOCK)
.try_exists()?
Expand Down Expand Up @@ -463,11 +473,6 @@ fn prepare_run_command_with_temp(
cmd.args(["-v", &format!("{}:/run/systemd-units:ro", units_dir)]);
}

// Propagate this by default
if let Some(log) = std::env::var("RUST_LOG").ok() {
cmd.arg(format!("--env=RUST_LOG={log}"));
}

// Pass configuration as JSON via BCK_CONFIG environment variable
let config = serde_json::to_string(&opts).unwrap();
cmd.args(["-e", &format!("BCK_CONFIG={config}")]);
Expand Down