north-config

Crates.ionorth-config
lib.rsnorth-config
version0.1.10
sourcesrc
created_at2022-08-25 20:51:40.96018
updated_at2024-01-13 01:16:17.951552
descriptionNorth config is a multi source configuration crate designed as part of the North Microservice Framework
homepagehttps://github.com/juicycleff/north-framework
repositoryhttps://github.com/juicycleff/north-framework
max_upload_size
id652406
size58,567
Rex Raphael (juicycleff)

documentation

https://docs.rs/north-config/

README

North Config

North config is a multi source configuration crate designed as part of the North Microservice Framework. It supports multiple source which are merged into one config as the final sources, with first in first applied directive merge pattern, meaning last config source will override the others.

Currently, North Config supports only local data sources with plans for supporting remote sources. Supported sources are json, yaml, ron, toml, and env variables.

Nesting or nested objects are supported for all source types

Supports async-std, tokio, with std as default

Getting Started

use north_config::{ConfigSource, EnvSourceOptions, NorthConfigOptions};

#[derive(Clone, serde::Deserialize, Debug)]
struct DemoConfig {
    pub host: Option<String>,
}

///#[tokio::main]
fn main() {
    let config_options = NorthConfigOptions {
        sources: vec![
            // ConfigSource::File("examples/configs/bootstrap.{{env}}.yaml".to_string()),
            ConfigSource::Env(EnvSourceOptions::default()),
        ],
    };
    let config = north_config::new_config::<DemoConfig>(config_options).await;
    let config = config.get_value();

    Ok(())
}
Commit count: 70

cargo fmt