https://github.com/alpheusday/dotenv_plus.rs
A dotenv extension for Rust
https://github.com/alpheusday/dotenv_plus.rs
dotenv env environment file rust var variables
Last synced: 5 months ago
JSON representation
A dotenv extension for Rust
- Host: GitHub
- URL: https://github.com/alpheusday/dotenv_plus.rs
- Owner: alpheustangs
- License: mit
- Created: 2024-09-27T06:18:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-20T15:13:03.000Z (about 1 year ago)
- Last Synced: 2024-10-20T16:56:47.115Z (about 1 year ago)
- Topics: dotenv, env, environment, file, rust, var, variables
- Language: Rust
- Homepage: https://docs.rs/dotenv_plus
- Size: 20.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dotenv+
A dotenv solution for Rust.
## Installation
To install this package, run the following command:
```bash
cargo add dotenv_plus
```
## Quick Start
Write the environment variables in the env files and access them later using the `var` function:
```
KEY=value
```
```rust
use dotenv_plus::{
DotEnv,
var,
};
DotEnv::new().run();
assert_eq!(var("RUST_ENV"), "production");
assert_eq!(var("KEY"), "value");
```
```sh
# By default, `RUST_ENV` is set to `development`
RUST_ENV=production cargo run
```
## License
This project is licensed under the terms of the MIT license.