improve mqtt

This commit is contained in:
csehviktor
2025-07-03 06:09:09 +02:00
parent dbbc673efe
commit 58a4ab9974
4 changed files with 115 additions and 0 deletions

14
server/src/config.rs Normal file
View 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)
}