Added config option to control discovery

This commit is contained in:
QuantumEntangledAndy authored and Andrew King committed 2023-02-22 09:55:28 +07:00
1 parent 3949dca1af
commit b49ce87f32
6 files changed
+95 -22

No files matched your search

+13
View File
@@ -10,6 +10,7 @@ lazy_static! {
Regex::new(r"^(mainStream|subStream|externStream|both|all)$").unwrap();
static ref RE_TLS_CLIENT_AUTH: Regex = Regex::new(r"^(none|request|require)$").unwrap();
static ref RE_PAUSE_MODE: Regex = Regex::new(r"^(black|still|test|none)$").unwrap();
static ref RE_DISC_SRC: Regex = Regex::new(r"^([nN]one|[lL]ocal|[rR]emote|[rR]elay)$").unwrap();
}
#[derive(Debug, Deserialize, Validate, Clone)]
@@ -75,6 +76,14 @@ pub(crate) struct CameraConfig {
#[validate]
#[serde(default = "default_pause")]
pub(crate) pause: PauseConfig,
#[serde(default = "default_discovery")]
#[validate(regex(
path = "RE_DISC_SRC",
message = "Invalid discovery method",
code = "discovery"
))]
pub(crate) discovery: String,
}
#[derive(Debug, Deserialize, Validate, Clone)]
@@ -119,6 +128,10 @@ fn default_mqtt() -> Option<MqttConfig> {
None
}
fn default_discovery() -> String {
"Relay".to_string()
}
#[derive(Debug, Deserialize, Validate, Clone)]
pub(crate) struct PauseConfig {
#[serde(default = "default_on_motion")]