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

app cargo-dotenv

A tiny cargo subcommand to run cargo commands with dotenv

2 stable releases

1.0.1 Jul 5, 2023

#270 in Cargo plugins

28 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.2–1.8MB
~35K SLoC