From eab96ef3d4dd73b5e9202b413c2c01857d582830711d55cfd5d36863c99f4072 Mon Sep 17 00:00:00 2001 From: Tyler J King Date: Sat, 25 Apr 2026 05:00:10 -0400 Subject: [PATCH] bascule-gateway: fix env-prefix separator + embedded accord parse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two bugs surfaced when bascule-gateway pods first reached Running and attempted config load (F.4 deployment): 1. Env-var override didn't take effect for any BASCULE_* variable. config::Environment::with_prefix("BASCULE") without an explicit prefix_separator strips the literal "BASCULE" with no separator, so BASCULE_ACCORD_PATH became "_ACCORD_PATH" (leading underscore) which doesn't match the field "accord_path". Result: every env override silently fell back to the default in config.rs, and the pod read /accord/accord.yaml instead of /etc/bascule/accord.yaml from the configured volume. Adds .prefix_separator("_") to match QM's pattern in services/quartermaster/src/config.rs:150. 2. Embedded fallback accord YAML had `sampled: []` and a stray `sampleRate: 1`, but the schema has `sampled: Option` — empty list mis-parses as struct. Result: when accord file lookup failed, the .expect("empty accord must parse") panicked, crashing the bascule-gateway container. Now omitted (Option default None). Both fixes verified against accord-core's schema in services/accord-core/src/schema.rs. Signed-off-by: Tyler J King --- bascule-gateway/src/config.rs | 1 + bascule-gateway/src/main.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bascule-gateway/src/config.rs b/bascule-gateway/src/config.rs index 9832ce8..0be859d 100644 --- a/bascule-gateway/src/config.rs +++ b/bascule-gateway/src/config.rs @@ -121,6 +121,7 @@ impl BasculeConfig { let config = config::Config::builder() .add_source( config::Environment::with_prefix("BASCULE") + .prefix_separator("_") .separator("__") .try_parsing(true), ) diff --git a/bascule-gateway/src/main.rs b/bascule-gateway/src/main.rs index cbeba75..468ac7e 100644 --- a/bascule-gateway/src/main.rs +++ b/bascule-gateway/src/main.rs @@ -69,8 +69,8 @@ spec: fidelity: always_notarize notarize: [] logOnly: [] - sampled: [] - sampleRate: 1 + # sampled omitted — Option default None (struct shape: + # {events: [...], sample_rate: N}), `sampled: []` would mis-parse. reconciliation: defaultWindow: "24h" onExpiry: alert