Skip to main content

load_dotenv

Function load_dotenv 

Source
pub fn load_dotenv()
Expand description

Load <appdata>/.env (~/.<service>/.env on bare metal, /data/.env in a container) into the process environment if present.

Best-effort: a missing file is ignored, and existing env vars are NOT overridden — values injected by docker-compose/systemd or the plugin hook’s CLAUDE_PLUGIN_OPTION_* mapping still take precedence. This lets the binary find its credentials directly from ~/.<service>/.env without relying on a process manager to inject them. Call once at startup before Config::load.