Skip to content

Commit

Permalink
Small doc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
allan2 committed Oct 5, 2024
1 parent 3530ed4 commit 5508e50
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A well-maintained fork of the [dotenv](https://github.com/dotenv-rs/dotenv) crat

This crate is the suggested alternative for `dotenv` in security advisory [RUSTSEC-2021-0141](https://rustsec.org/advisories/RUSTSEC-2021-0141.html).

This library loads environment variables from an env file.
This library enables loading environment variables from an env file.

## Components

Expand Down Expand Up @@ -58,7 +58,7 @@ let str_loader = EnvLoader::with_reader(Cursor::new(s));
let overriding_loader = EnvLoader::new().sequence(EnvSequence::EnvThenInput);
```

Load constuction is infallible. I/O is derred until `load` or `load_and_modify` is called.
Loader constuction is infallible. I/O is derred until `load` or `load_and_modify` is called.
This is to allow support configurations such as [dev/prod](examples/dev-prod/src/main.rs) and
[optional loading](examples/optional/src/main.rs).

Expand Down Expand Up @@ -100,14 +100,11 @@ The `load` attribute macro can be used to do this. To use it, enable the `macros
```rs
#[dotenvy::load] // will call `load_and_modify` before the async runtime is started
#[tokio::main]
async fn main() -> Result<(), Box<dyn error::Error>> {
println!("HOST={}", env::var("HOST")?);
async fn main() {
println!("HOST={}", env::var("HOST").unwrap());
Ok(())
}
```
`dotenvy::load` must be placed before `tokio::main`.

A non-macro example is [here](examples/modify-tokio/src/main.rs).

### Loading at compile time

Expand Down

0 comments on commit 5508e50

Please sign in to comment.