#env-var #variables #cargo #cargo-command #toml #environment #dotenv

app cargo-env-run

Like dotenv but with .cargo/config.toml files

4 releases (2 breaking)

0.3.1 Dec 5, 2024
0.3.0 Oct 26, 2024
0.2.0 Sep 14, 2024
0.1.0 Sep 14, 2024

#227 in Cargo plugins

Download history 322/week @ 2024-09-11 37/week @ 2024-09-18 10/week @ 2024-09-25 8/week @ 2024-10-02 3/week @ 2024-10-09 5/week @ 2024-10-16 110/week @ 2024-10-23 21/week @ 2024-10-30 17/week @ 2024-11-06 1/week @ 2024-11-13 1/week @ 2024-11-20 161/week @ 2024-12-04 5/week @ 2024-12-11

166 downloads per month

MIT license

8KB
75 lines

About

Like dotenv but with .cargo/config.toml files

$ env |grep ^CARGO_ENV_RUN_TEST
$ cat .cargo/config.toml
[env]
CARGO_ENV_RUN_TEST = "IT WORKS"
$ cargo env-run env |grep ^CARGO_ENV_RUN_TEST
CARGO_ENV_RUN_TEST=IT WORKS

This crate/utility does not intend to replace dotenv or similar utilites, and was originally designed to overcome Helix Editor's inability to recognize a compile-time environment variable being set in a .cargo/config.toml file instead of the current environment. Using this utility, the fix for this scenario is to prefix the hx src/main.rs command with cargo env-run which loads environment variables from .cargo/config.toml files and then runs the given command.

Dependencies

~4–13MB
~170K SLoC