Crates.io | load-env |
lib.rs | load-env |
version | 0.3.0 |
source | src |
created_at | 2023-04-04 02:07:13.515813 |
updated_at | 2023-05-05 19:42:15.155272 |
description | A tool to load .env files |
homepage | |
repository | |
max_upload_size | |
id | 829709 |
size | 4,233 |
CLI wrapper for loading .env files, written in rust
Install globally with cargo:
cargo install load-env
Create .env file in your project:
DATABASE_URL="postgres://user:password@host:port/db"
Load the .env with cli:
load-env <your-command>
You can use the naming convention for .env files, such as in nextjs
, Vite
, etc.
For example, create a .env.local
for local usage:
# .env.local
DATABASE_URL="postgres://user:password@host:port/db-local"
and .env.test.local
for run tests:
# .env.test.local
DATABASE_URL="postgres://user:password@host:port/db-test"
.env.local
will be loaded in any case, for load .env.test.local
you need to specify the mode flag:
load-env -m test <your-command>
.env # loaded in all cases
.env.local # loaded in all cases, ignored by git
.env.[mode] # only loaded in specified mode
.env.[mode].local # only loaded in specified mode, ignored by git