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:
19
server/mqtt.toml
Normal file
19
server/mqtt.toml
Normal file
@@ -0,0 +1,19 @@
|
||||
id = 0
|
||||
|
||||
[router]
|
||||
id = 0
|
||||
max_connections = 10010
|
||||
max_outgoing_packet_count = 200
|
||||
max_segment_size = 104857600
|
||||
max_segment_count = 10
|
||||
|
||||
[v4.1]
|
||||
name = "v4-1"
|
||||
listen = "0.0.0.0:1883"
|
||||
next_connection_delay_ms = 1
|
||||
|
||||
[v4.1.connections]
|
||||
connection_timeout_ms = 60000
|
||||
max_payload_size = 20480
|
||||
max_inflight_count = 100
|
||||
dynamic_filters = true
|
||||
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