sincecutoff.com
← all changes

cargo-lambda build accepts environment variables

Introduced 2026-02-15 · score 0.98

HOW TO USE IT

When a build needs environment variables, pass them with `--env-var` or load them with `--env-file`; CLI values override metadata, and `--env-var` overrides `--env-file`.

cargo lambda build --env-var <KEY>=<VALUE>
cargo lambda build --env-file <PATH>
[package.metadata.lambda.build] env_var = ["<KEY>=<VALUE>"] env_file = "<PATH>"

WHY THIS HELPS

Build a project that needs configured environment variables during the cargo build process.

REQUIREMENTS AND LIMITATIONS

  • Version: v1.9.0
  • --env-var <KEY>=<VALUE>: Sets environment variables for the cargo build process. Repeat the flag or give comma-separated pairs.
  • --env-file <PATH>: Loads environment variables from a file, one `KEY=VALUE` entry per line.
  • env_var: Cargo metadata array of `KEY=VALUE` strings for build-time variables.
  • env_file: Cargo metadata path to an environment file for the build.
  • Environment files should contain one `KEY=VALUE` entry per line.
  • The stated precedence is environment file, then command-line `--env-var`; CLI values override metadata.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card