# Use the CLI

[← Back to Rust](https://dotenvx.com/docs/rust.md#ship)

If you prefer process environment variables, let the CLI load them before your app starts:

```rust
// src/main.rs
fn main() -> Result<(), Box<dyn std::error::Error>> {
    let hello = std::env::var("HELLO")?;
    println!("Hello {hello}");
    Ok(())
}
```

```console
$ dotenvx run --strict -- cargo run
Hello Secret
```

For production, install the CLI on the host and wrap your compiled binary:

```console
$ dotenvx run -f .env.production --strict -- ./hello-rust
Hello Production
```

This uses the CLI's key resolution. The Rust code only reads the resulting environment; it does not call dotenvx-primitives. See [CLI run](https://dotenvx.com/docs/cli/run/) for its options.
