5 releases

0.1.0 Mar 15, 2023
0.0.3 Oct 26, 2022
0.0.2 May 18, 2022
0.0.1 Apr 23, 2022
0.0.0 Apr 19, 2022

#3 in #layered

Download history 2620/week @ 2023-12-01 2150/week @ 2023-12-08 2569/week @ 2023-12-15 1838/week @ 2023-12-22 1419/week @ 2023-12-29 1908/week @ 2024-01-05 2715/week @ 2024-01-12 2896/week @ 2024-01-19 2151/week @ 2024-01-26 1883/week @ 2024-02-02 101/week @ 2024-02-09 1402/week @ 2024-02-16 2605/week @ 2024-02-23 2414/week @ 2024-03-01 1631/week @ 2024-03-08 2705/week @ 2024-03-15

9,608 downloads per month
Used in blooming

Apache-2.0

34KB
683 lines

serfig   Build Status Latest Version

Layered configuration system built upon serde

Quick Start

use serde::{Deserialize, Serialize};
use serfig::collectors::{from_env, from_file, from_self};
use serfig::parsers::Toml;
use serfig::Builder;

#[derive(Debug, Serialize, Deserialize, PartialEq, Default)]
#[serde(default)]
struct TestConfig {
    a: String,
    b: String,
    c: i64,
}

fn main() -> anyhow::Result<()> {
    let builder = Builder::default()
        .collect(from_env())
        .collect(from_file(Toml, "config.toml"))
        .collect(from_self(TestConfig::default()));
    let t: TestConfig = builder.build()?;

    println!("{:?}", t);
    Ok(())
}

Contributing

Check out the CONTRIBUTING.md guide for more details on getting started with contributing to this project.

Getting help

Submit issues for bug report or asking questions in discussion.

Acknowledgment

This project is highly inspired by config-rs

License

Licensed under Apache License, Version 2.0.

Dependencies

~2MB
~33K SLoC