#applications #yaml-serialization

pepe-config

Configuration functions for PepeTeam template application

18 releases

new 0.2.7 Mar 28, 2025
0.2.3 Apr 12, 2024
0.2.2 Sep 15, 2023
0.2.0 Apr 17, 2023
0.0.1 Mar 28, 2022

#307 in Configuration

Download history 10/week @ 2024-12-06 1/week @ 2024-12-13 8/week @ 2025-01-10 3/week @ 2025-02-21 159/week @ 2025-02-28 2/week @ 2025-03-07

164 downloads per month

MIT license

17KB
425 lines

Example of usage

use serde::{Deserialize, Serialize};

pub const DEFAULT_CONFIG: &str = include_str!("../config.yaml");

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Config {
    pub port: u16,
    pub dry_run_mode: bool
}

impl Config {
    pub fn load() -> Result<Self, pepe_config::ConfigError> {
        pepe_config::load(DEFAULT_CONFIG, pepe_config::FileFormat::Yaml)
    }
}

Tests

Should be run in 1 thread due to environment variables usage.

cargo test -- --test-threads 1

Dependencies

~4MB
~90K SLoC