Skip to main content

Module env

Module env 

Source
Expand description

Environment-variable dependency-injection seam.

Production code reads the process environment only through an EnvSource. The real implementation, SystemEnv, delegates to std::env::var; tests inject a pure in-memory fake (crate::test_support::env::MapEnv) instead of mutating the process-global environment.

This removes the shared mutable global that the cross-module test race (issue #821) and the per-module env mutexes (#950, #1030) were fighting over: a test that constructs its own EnvSource never touches process env, so it needs no lock and runs fully in parallel. See STYLE-0027 and docs/plan/issue-1030-env-di.md.

EnvSource abstracts the raw environment only. The settings.json fallback layer composes on top of it — see crate::utils::settings.

Structs§

SystemEnv
The real process environment, backed by std::env::var.

Traits§

EnvSource
A read-only view of environment variables.