An open API service indexing awesome lists of open source software.

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

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.