Documentation
¶
Overview ¶
Package leaf handles the mapping between store targets and the concrete dotfiles on disk, plus dotenv parsing/serialization.
Filename convention (derived from a target's basepath directory + env + tier):
tier=buildtime -> <dir>/.env[.<env>] (read by the build; NEXT_PUBLIC_*, etc.) tier=runtime -> <dir>/.dev.vars[.<env>] (read by wrangler locally; pushed as secrets)
The sentinel env "_" (store.DefaultEnv) produces suffix-less files: .env and .dev.vars.
Index ¶
Constants ¶
const IgnoredHeader = "# ward-ignored variables below"
IgnoredHeader introduces the trailing block of ward-ignored variables in a generated leaf file. Variables below it are preserved (their parsed values re-serialized) and never captured into the store.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse reads dotenv content into a flat map. It ignores blank lines and comment lines (leading '#'); the store is the source of truth for structure, so comments live only in *.example files and are intentionally dropped here. Surrounding single or double quotes on values are stripped. A leading "export " is tolerated.
func Path ¶
Path returns the full path (dir joined with the derived filename) for a target basepath, tier, and env.
func Serialize ¶
Serialize renders a flat map into deterministic dotenv content (keys sorted), quoting values that contain whitespace or characters that would otherwise be ambiguous. A generated-file header warns humans not to edit blindly.
func SerializeWithIgnored ¶ added in v0.0.4
SerializeWithIgnored renders the managed values followed by an ignored block. The ignored block (introduced by IgnoredHeader) is only emitted when there is at least one ignored variable to preserve, so files with no ignored variables look exactly as before.
Types ¶
This section is empty.