Skip to main content

load

Function load 

Source
pub fn load(config_dir: &Path) -> Result<LoadedConfig, Error>
Expand description

Load a vane config directory.

Order of operations:

  1. If <config_dir>/.env exists, run dotenvy::from_path on it. Pre-existing OS env keys win — operators who set values via systemd / EnvironmentFile= / docker -e flag override what’s in .env. A missing .env is not an error; many deployments rely entirely on OS-level env.
  2. Scan <config_dir>/rules/*.json via scan_rules_dir.
  3. Read VANE_* deployment constants into Env.

§Errors

  • <config_dir>/rules/ does not exist or is not a directory (propagated from scan_rules_dir).
  • Any .json under rules/ fails to parse as RawRuleFile.
  • Any VANE_* env var has an invalid value (non-integer, not "0"/"1" for booleans, malformed SocketAddr, etc.).

Not an error:

  • .env file is missing.
  • <config_dir>/config.json is missing or malformed (it is not parsed at this stage).