https://github.com/jasperav/env_parser
Parses an env file which can be used to map properties in Rust code
https://github.com/jasperav/env_parser
env parser rust
Last synced: over 1 year ago
JSON representation
Parses an env file which can be used to map properties in Rust code
- Host: GitHub
- URL: https://github.com/jasperav/env_parser
- Owner: Jasperav
- License: apache-2.0
- Created: 2020-10-17T16:55:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-03T10:51:46.000Z (over 2 years ago)
- Last Synced: 2025-02-28T07:51:57.068Z (over 1 year ago)
- Topics: env, parser, rust
- Language: Rust
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# Env parser
[](https://crates.io/crates/env_parser)
[](https://github.com/jasperav/env_parser/actions)
This crate will parse an `.env` file. By implementing the `Transformer` trait, you can
customize the behaviour after processing key value pair in the env file. Comments are preserved and
can be used on top of the Rust mapped property.
For convenience there is a feature `to_lazy_static` that will automatically map key value pairs into a `lazy_static` block.
Check `assert_test.rs` and `assert_test_lazy.rs` for examples.
## Usage
Add the following to your Cargo.toml...
```toml
[dependencies]
env_parser = "*"
```
Ideally, create `build.rs` file and call the `env_parser` reader from the build file, so that your mapped Rust file
is always in sync with your `.env` file.
#### License
Licensed under either of Apache License, Version
2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
be dual licensed as above, without any additional terms or conditions.