#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

#429 in Cargo plugins

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
~31K SLoC