dotenv_parser/
lib.rs

1//! The parser handles comments, strings and the `export` syntax automatically.
2//!
3//! # Example
4//! ```
5//! use dotenv_parser::parse_dotenv;
6//!
7//! fn main() {
8//!     let source = r#"
9//!         ## main comment
10//!         ENV_FOR_HYDRO='testing 2' # another one here
11//!         export USER_ID=5gpPN5rcv5G41U_S
12//!         API_TOKEN=30af563ccc668bc8ced9e24e  # relax! these values are fake
13//!         APP_SITE_URL=https://my.example.com
14//!     "#;
15//!
16//!     let map = vec![
17//!         ("ENV_FOR_HYDRO", "testing 2"),
18//!         ("USER_ID", "5gpPN5rcv5G41U_S"),
19//!         ("API_TOKEN", "30af563ccc668bc8ced9e24e"),
20//!         ("APP_SITE_URL", "https://my.example.com"),
21//!     ]
22//!     .into_iter()
23//!     .map(|(a, b)| (a.into(), b.into()))
24//!     .collect();
25//!
26//!     let res = parse_dotenv(source).unwrap();
27//!     assert_eq!(res, map);
28//! }
29
30#![deny(missing_docs)]
31
32extern crate pest;
33#[macro_use]
34extern crate pest_derive;
35
36mod parser;
37pub use parser::parse_dotenv;