Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(config): add update module to env_overlay schema

Steven Enamakel1342d45a8645
diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay.rs b/crates/openhuman-core/src/config/schema/load/env_overlay.rs
index b4263badd1..b00721483f 100644
--- a/crates/openhuman-core/src/config/schema/load/env_overlay.rs
+++ b/crates/openhuman-core/src/config/schema/load/env_overlay.rs
@@ -9,6 +9,7 @@ mod observability;
mod proxy;
mod runtime;
mod search;
+mod update;
use super::super::proxy::{set_runtime_proxy_config, ProxyScope};
use super::super::Config;
diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay/update.rs b/crates/openhuman-core/src/config/schema/load/env_overlay/update.rs
new file mode 100644
index 0000000000..b5f5397573
--- /dev/null
+++ b/crates/openhuman-core/src/config/schema/load/env_overlay/update.rs
@@ -0,0 +1,48 @@
+//! Env overrides for the auto-updater (`[update]`).
+
+use crate::config::schema::load::env::parse_env_bool;
+use crate::config::schema::load::env::EnvLookup;
+use crate::config::schema::Config;
+use crate::config::schema::UpdateRestartStrategy;
+
+impl Config {
+ pub(super) fn apply_update_env<E: EnvLookup + ?Sized>(&mut self, env: &E) {
+ if let Some(flag) = env.get("OPENHUMAN_AUTO_UPDATE_ENABLED") {
+ let normalized = flag.trim().to_ascii_lowercase();
+ match normalized.as_str() {
+ "1" | "true" | "yes" | "on" => self.update.enabled = true,
+ "0" | "false" | "no" | "off" => self.update.enabled = false,
+ _ => {}
+ }
+ }
+ if let Some(val) = env.get("OPENHUMAN_AUTO_UPDATE_INTERVAL_MINUTES") {
+ if let Ok(minutes) = val.trim().parse::<u32>() {
+ self.update.interval_minutes = minutes;
+ }
+ }
+ if let Some(raw) = env.get("OPENHUMAN_AUTO_UPDATE_RESTART_STRATEGY") {
+ match raw.trim().to_ascii_lowercase().as_str() {
+ "self_replace" | "self-replace" | "self" => {
+ self.update.restart_strategy = UpdateRestartStrategy::SelfReplace;
+ }
+ "supervisor" | "stage_only" | "stage-only" => {
+ self.update.restart_strategy = UpdateRestartStrategy::Supervisor;
+ }
+ other => {
+ tracing::warn!(
+ value = other,
+ "ignoring invalid OPENHUMAN_AUTO_UPDATE_RESTART_STRATEGY \
+ (valid: self_replace, supervisor)"
+ );
+ }
+ }
+ }
+ if let Some(flag) = env.get("OPENHUMAN_AUTO_UPDATE_RPC_MUTATIONS_ENABLED") {
+ if let Some(enabled) =
+ parse_env_bool("OPENHUMAN_AUTO_UPDATE_RPC_MUTATIONS_ENABLED", &flag)
+ {
+ self.update.rpc_mutations_enabled = enabled;
+ }
+ }
+ }
+}