Crate confu[][src]

Expand description

Confu is a no frills Rust application configuration library. It supports getting configuration from environment, command line arguments and defaults.

Specificity: defaults -> environment -> arguments. Arguments being the most specific, will take precedence over the corresponding environment values, or default values, if such were also defined.

Examples

use confu::Confu;

#[derive(Confu)]
#[confu_prefix = "APP_"]
struct Config {
    #[default = "postgres"]
    db_user: String,

    #[protect]
    #[default = "postgres"]
    db_password: String,

    #[default = "127.0.0.1"]
    api_host: String,

    #[require]
    telemetry: String,

    #[hide]
    super_secret_stuff: String,
}

fn main() {
    let config = Config::confu();
    config.show();
}

Traits

Confu

derived automatically for any non-enum like struct that contain only the named String fields via #[derive(Confu)].

Derive Macros

Confu

derives confu::Confu trait methods