#cargo-command #env-var #env-file #run #dotenv #variables #utility

app cargo-dotenv

A tiny cargo subcommand to run cargo commands with dotenv

2 stable releases

1.0.1 Jul 5, 2023

#397 in Cargo plugins

Download history 1/week @ 2024-07-01 11/week @ 2024-09-23 59/week @ 2024-09-30 9/week @ 2024-10-07

79 downloads per month

MIT license

5KB
56 lines

This is a tiny utility that injects env variables before running cargo commands.

I built this utility specifically because IntelliJ Rust does not support .env files, nor does the EnvFile plugin support Rust.

Otherwise, I recommend adding env variables through just, your shell, or other means.

Usage

# Runs `cargo run` with env coming from `.env`
cargo dotenv run
# Runs `cargo check` with env coming from `.env.production`
cargo dotenv -e .env.production check

You can run dotenv recursively arbitrarily. This fact is useless, but I find it amusing.

cargo dotenv dotenv dotenv dotenv dotenv dotenv dotenv dotenv dotenv check

Installation

cargo install cargo-dotenv

Issue Tracker

Dependencies

~1.1–1.7MB
~32K SLoC