File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,13 @@ pub struct CommonPodmanOptions {
154154 help = "Add metadata to the container in key=value form"
155155 ) ]
156156 pub label : Vec < String > ,
157+
158+ #[ clap(
159+ long = "env" ,
160+ short = 'e' ,
161+ help = "Set environment variables in the container (key=value)"
162+ ) ]
163+ pub env : Vec < String > ,
157164}
158165
159166/// Common VM configuration options for hardware, networking, and features.
@@ -400,6 +407,9 @@ fn prepare_run_command_with_temp(
400407 if opts. podman . detach {
401408 cmd. arg ( "-d" ) ;
402409 }
410+ for env in opts. podman . env . iter ( ) {
411+ cmd. arg ( format ! ( "--env={env}" ) ) ;
412+ }
403413
404414 let vhost_dev = Utf8Path :: new ( qemu:: VHOST_VSOCK )
405415 . try_exists ( ) ?
@@ -463,11 +473,6 @@ fn prepare_run_command_with_temp(
463473 cmd. args ( [ "-v" , & format ! ( "{}:/run/systemd-units:ro" , units_dir) ] ) ;
464474 }
465475
466- // Propagate this by default
467- if let Some ( log) = std:: env:: var ( "RUST_LOG" ) . ok ( ) {
468- cmd. arg ( format ! ( "--env=RUST_LOG={log}" ) ) ;
469- }
470-
471476 // Pass configuration as JSON via BCK_CONFIG environment variable
472477 let config = serde_json:: to_string ( & opts) . unwrap ( ) ;
473478 cmd. args ( [ "-e" , & format ! ( "BCK_CONFIG={config}" ) ] ) ;
You can’t perform that action at this time.
0 commit comments