Documentation
¶
Overview ¶
Package dotenv reads the env vars of an app from one .env text, KEY=value per line, writes them as one, and says what replacing them with such a text changes. The CLI, the TUI, the hub and the daemon share it, so a text means the same everywhere.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Format ¶
Format writes env as a .env text Parse reads back exactly, and docker compose too: one KEY="value" per line, sorted by key, with \, ", $ and line breaks escaped, so compose fills in no ${VAR} of a value.
func Parse ¶
Parse reads a .env text. Empty lines and lines starting with # are skipped, "export " in front of a key is allowed. A value may be bare, in single quotes (taken as it is) or in double quotes, where \n, \", \\ and \$ stand for a line break, a quote, a backslash and a dollar; \r for a carriage return. An error names the line by its number only, never by what is on it: a broken line may hold a secret.
Types ¶
type Change ¶
type Change struct {
Added []string `json:"added"`
Replaced []string `json:"replaced"`
Removed []string `json:"removed"`
}
Change is what replacing the env vars with others does, by key, sorted. Replaced are the keys there were and that come again: moin never reads a value back, so it cannot tell a new value from the same one.