mirror of
https://github.com/csehviktor/status-monitor.git
synced 2025-08-08 18:06:14 +02:00
improve mqtt
This commit is contained in:
14
server/src/config.rs
Normal file
14
server/src/config.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
use rumqttd::Config;
|
||||
|
||||
const BROKER_CONFIG_PATH: &str = if cfg!(debug_assertions) {
|
||||
"server/mqtt.toml"
|
||||
} else {
|
||||
"mqtt.toml"
|
||||
};
|
||||
|
||||
pub fn load_broker_config() -> anyhow::Result<Config> {
|
||||
let content = std::fs::read_to_string(BROKER_CONFIG_PATH)?;
|
||||
let config: Config = toml::from_str(&content)?;
|
||||
|
||||
Ok(config)
|
||||
}
|
||||
Reference in New Issue
Block a user