trail-config 0.4.0

A Rust library for reading config files with path-based access, typed deserialization, environment overlays, deep merging, env variable interpolation, and hot reload support.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use std::fs;
use yaml_serde::{Value, from_str};
use crate::error::ConfigError;

pub(crate) fn load_file(filename: &str) -> Result<Value, ConfigError> {
    let yaml = fs::read_to_string(filename)?;
    parse(&yaml)
}

pub(crate) fn parse(yaml: &str) -> Result<Value, ConfigError> {
    from_str(yaml).map_err(|e| ConfigError::YamlError(e.to_string()))
}