yaac

Crates.ioyaac
lib.rsyaac
version0.1.2
sourcesrc
created_at2023-10-30 07:08:05.002453
updated_at2023-10-31 06:53:56.092465
descriptionyet another another config lib for web application
homepagehttps://github.com/Kilerd/yaac
repository
max_upload_size
id1018178
size26,092
Kilerd Chan (Kilerd)

documentation

README

yaac

Yet another another configuration lib for web application

GitHub Workflow Status (with branch) Crates.io Crates.io (recent) docs.rs Crates.io

Features

  • hierarchy file supported: file source allow users to load config from multiple files
  • environment variable resolver: yaac can resolve the placeholder like ${APP_KEY_NAME}
  • path variable resolver: yaac can resolve the placeholder like ${parent.sub.key_name}

Installation

$ cargo add yaac

Example

#[derive(Debug, Deserialize)]
struct Config {
    original: String,
    value: String,
}
fn main() {
    let mut loader = ConfigLoader::new();
    loader.add_source(FileSource::new("configuration/application.toml"));
    loader.add_source(FileSource::new("configuration/application_database.toml"));
    loader.add_source(EnvironmentSource::new("APP"));
    loader.enable_environment_variable_processor();
    loader.enable_path_variable_processor();

    let config: Config = loader.construct()?;
}

Contributing

Want to join us? Check out our "Contributing" guide and take a look at some of these issues:

License

This project is licensed under MIT license (LICENSE-MIT or [http://opensource.org/licenses/MIT]).

Commit count: 0

cargo fmt