Skip to main content

Module config

Module config 

Source
Expand description

Config loading entry point.

See spec/architecture/09-config.md. The MVP scope of this module:

  1. Best-effort dotenvy load of <config_dir>/.env. OS env winsdotenvy::from_path does not override pre-existing keys, which matches operator expectations (systemd / supervisor unit files are authoritative).
  2. Scan <config_dir>/rules/*.json for RawRuleFiles.
  3. Read every VANE_* deployment constant into a typed Env snapshot.

Out of MVP scope (not parsed yet): <config_dir>/config.json. The global daemon settings file (listeners, management, wasm pool config per 09-config.md § Top-level file schema) is the daemon’s own startup concern — its schema is still in flux through S2. Today it is silently ignored.

Feature: S1-26 + S1-26a.

Structs§

Env
Typed snapshot of every VANE_* deployment constant the daemon reads at startup. Defaults match spec/architecture/09-config.md § Three-layer configuration.
LoadedConfig
Result of load: rule files (unmerged) plus the typed Env snapshot. Downstream callers thread files into crate::compile::compile and read env for deployment constants.
ProcessEnv
Production EnvReader — reads from std::env.

Traits§

EnvReader
Reads a key → optional string value. The single production implementation, ProcessEnv, delegates to std::env::var. Tests hand-roll a fake EnvReader to keep state local.

Functions§

load
Load a vane config directory.
scan_rules_dir
Scan a directory for *.json rule files. Returns one RawRuleFile per discovered file with path populated from the on-disk filename. Order of the returned vector is unspecified — the merge stage sorts by (order asc, path lex) so the loader does not pre-sort.