fluxmq 0.1.0

High-performance message broker and streaming platform inspired by Apache Kafka
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::BrokerConfig;
use crate::Result;
use config::{Config, Environment};

impl BrokerConfig {
    pub fn from_env() -> Result<Self> {
        let settings = Config::builder()
            .add_source(Environment::with_prefix("FLUXMQ"))
            .build()
            .map_err(|e| crate::FluxmqError::Config(e.to_string()))?;

        let config = settings
            .try_deserialize::<BrokerConfig>()
            .map_err(|e| crate::FluxmqError::Config(e.to_string()))?;

        Ok(config)
    }
}