Struct zenv::Zenv [−][src]
pub struct Zenv { /* fields omitted */ }
Expand description
Use this to load and configure the environment variables
Implementations
impl Zenv
[src]
impl Zenv
[src]pub fn new(path: &str, expand: bool) -> Self
[src]
pub fn new(path: &str, expand: bool) -> Self
[src]Create a new instance of Zenv with the provided file path
pub fn parse(&self) -> Result<HashMap<String, String>>
[src]
pub fn parse(&self) -> Result<HashMap<String, String>>
[src]Read and parse the file from provided path and returns a hashmap
Example
let parsed = zenv::Zenv::new("tests/.env.basic", false).parse().unwrap(); assert_eq!(parsed.get("BASIC"), Some(&"basic".to_string()))
pub fn configure(&self) -> Result<()>
[src]
pub fn configure(&self) -> Result<()>
[src]Parse the file using Zenv::parse and sets the environment variable
Example
zenv::Zenv::new("tests/.env.basic", false).configure().ok(); assert_eq!(std::env::var_os("BASIC"), Some("basic".into()))