Skip to main content

Crate envigil

Crate envigil 

Source
Expand description

§envigil

Keep vigil over your environment.

use envigil::{EnvSource, VarBuilder};

let cfg = EnvSource::new()
    .prefix("APP_")
    .declare(VarBuilder::new("PORT", |v| v.parse::<u16>().map_err(|e| e.to_string()))
        .default(8080))
    .load()?;

let port: &u16 = cfg.get("PORT")?;

Re-exports§

pub use error::Error;
pub use error::Result;
pub use secret::Secret;
pub use source::Env;
pub use source::EnvSource;
pub use var::VarBuilder;

Modules§

error
Error types for environment configuration.
layer
Pluggable configuration sources.
parse
Ready-made parser functions for common types.
secret
A wrapper that prevents accidental leakage of sensitive values.
source
Loading environment variables into a typed container.
validate
Validation primitives for environment variable values.
var
Declaration and resolution of a single environment variable.