bascule-gateway: fix env-prefix separator + embedded accord parse

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<SampledConfig {events, sample_rate}>` — 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 <tking@guildhouse.dev>
This commit is contained in:
Tyler J King 2026-04-25 05:00:10 -04:00
parent 2cfc0b4d5e
commit eab96ef3d4
2 changed files with 3 additions and 2 deletions

View file

@ -121,6 +121,7 @@ impl BasculeConfig {
let config = config::Config::builder() let config = config::Config::builder()
.add_source( .add_source(
config::Environment::with_prefix("BASCULE") config::Environment::with_prefix("BASCULE")
.prefix_separator("_")
.separator("__") .separator("__")
.try_parsing(true), .try_parsing(true),
) )

View file

@ -69,8 +69,8 @@ spec:
fidelity: always_notarize fidelity: always_notarize
notarize: [] notarize: []
logOnly: [] logOnly: []
sampled: [] # sampled omitted Option<SampledConfig> default None (struct shape:
sampleRate: 1 # {events: [...], sample_rate: N}), `sampled: []` would mis-parse.
reconciliation: reconciliation:
defaultWindow: "24h" defaultWindow: "24h"
onExpiry: alert onExpiry: alert