pub fn load_dotenv() -> Option<PathBuf>Expand description
Load environment variables from the project’s .env file.
Walks up from the current working directory looking for a project root
marker (config/anvil.toml, then Cargo.toml) and loads .env from that
directory only — it does NOT walk further up. This avoids accidentally
picking up a parent project’s .env when the Anvil project is nested
inside another codebase.
Idempotent. The first call does the work; subsequent calls return the
same cached Option<PathBuf>. That’s what makes it safe to invoke
implicitly from *Config::from_env() — tests get a .env-loaded process
even though they never run main.rs.
Returns the path of the .env that was loaded, or None if no project
root or no .env was found. Callers can log this after tracing_init.