v0.14.2-connectivity
This commit is contained in:
@@ -76,6 +76,9 @@ impl Config {
|
||||
zone_interval_seconds: self.zone_interval_seconds.max(2),
|
||||
discovery_timeout_ms: self.discovery_timeout_ms.clamp(300, 30_000),
|
||||
discovery_broadcast: self.discovery_broadcast.clone(),
|
||||
ping_metrics_enabled: env_bool("GREE_CONTROLLER_PING_METRICS_ENABLED").unwrap_or(true),
|
||||
ping_interval_seconds: env_u64("GREE_CONTROLLER_PING_INTERVAL_SECONDS").unwrap_or(60).clamp(10, 3600),
|
||||
ping_sample_count: env_u32("GREE_CONTROLLER_PING_SAMPLE_COUNT").unwrap_or(3).clamp(1, 10),
|
||||
house_mode: env::var("GREE_CONTROLLER_HOUSE_MODE").unwrap_or_else(|_| "cool".into()),
|
||||
control_strategy: "setpoint".into(),
|
||||
outdoor_assist_enabled: env_bool("GREE_CONTROLLER_OUTDOOR_ASSIST_ENABLED")
|
||||
@@ -137,6 +140,15 @@ impl Config {
|
||||
|
||||
/// Environment values explicitly supplied by the service override persisted runtime values.
|
||||
pub fn apply_runtime_env_overrides(&self, settings: &mut RuntimeSettings) {
|
||||
if let Some(value) = env_bool("GREE_CONTROLLER_PING_METRICS_ENABLED") {
|
||||
settings.ping_metrics_enabled = value;
|
||||
}
|
||||
if let Some(value) = env_u64("GREE_CONTROLLER_PING_INTERVAL_SECONDS") {
|
||||
settings.ping_interval_seconds = value.clamp(10, 3600);
|
||||
}
|
||||
if let Some(value) = env_u32("GREE_CONTROLLER_PING_SAMPLE_COUNT") {
|
||||
settings.ping_sample_count = value.clamp(1, 10);
|
||||
}
|
||||
if env::var_os("GREE_CONTROLLER_HISTORY_RETENTION_DAYS").is_some() {
|
||||
settings.history_retention_days = env_u32("GREE_CONTROLLER_HISTORY_RETENTION_DAYS")
|
||||
.unwrap_or(settings.history_retention_days)
|
||||
|
||||
Reference in New Issue
Block a user