Skip to main content

Module env_file

Module env_file 

Source
Expand description

Provider keys from a file, for sessions that did not export them: a Claude Code session started without GEMINI_API_KEY failed every blyte dispatch at turn 0 (2026-09-29).

The file is $BLYTE_ENV_FILE (empty turns it off), else $XDG_CONFIG_HOME/blyte/env, else ~/.config/blyte/env: NAME=value lines, with an optional export prefix, surrounding quotes, blank lines and # comments. A variable already set in the environment wins. A file other users can read is not loaded.

Functionsยง

default_path
Where blyte looks for the file, or None when it is turned off.
get
Reads the value of name from path, or Ok(None) if the file or variable is absent.
load
Sets each variable in the file at path that is not already set, and returns their names. A missing file sets nothing. Call it before any threads start: it uses std::env::set_var.
parse
The NAME=value pairs in text.
set
Sets one or more NAME=value lines in the file at path: replaces an existing line for the same name, keeps all other lines and comments, and appends new names. Creates the file and its parent directory if needed, with file mode 0600 on Unix.