#env-file #key-value #env #parser #lazy-static #pair #properties

env_parser

Env parser. Parse your env file and create a Rust file with mapped properties

11 releases

0.1.10 Jan 3, 2024
0.1.8 Dec 28, 2023
0.1.7 Oct 26, 2023
0.1.6 Feb 21, 2021
0.1.2 Nov 22, 2020

#2 in #lazy-static

Download history 6/week @ 2023-12-18 25/week @ 2023-12-25 30/week @ 2024-01-01 44/week @ 2024-02-26 2/week @ 2024-03-11 189/week @ 2024-04-01

191 downloads per month

MIT/Apache

17KB
349 lines

Env parser

Latest Version Build Status

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...

[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.

No runtime deps