Documentation
¶
Overview ¶
Package envfile loads simple dotenv-style files without overriding process environment values.
Index ¶
Constants ¶
const ( // MaxLineBytes is the maximum logical line size accepted in an env file. MaxLineBytes = 1 << 20 DiagnosticLineTooLong = "env_file_line_too_long" )
Variables ¶
This section is empty.
Functions ¶
func Load ¶ added in v0.13.0
func Load(path string, explicit bool, process []string) (Environment, LoadResult, error)
Load parses path into an explicit environment overlay without mutating the process environment.
Types ¶
type DiagnosticError ¶ added in v0.13.0
DiagnosticError describes an env-file parse diagnostic without exposing the input value.
func (*DiagnosticError) Error ¶ added in v0.13.0
func (err *DiagnosticError) Error() string
type Environment ¶ added in v0.13.0
Environment is an explicit environment overlay. Process values win over file values. Constructors and accessors make defensive copies so project loading can pass environments between concurrent workspaces without global mutable state.
func NewEnvironment ¶ added in v0.13.0
func NewEnvironment(process []string, entries []Entry) Environment
NewEnvironment constructs an overlay from a process-style NAME=value slice and parsed file entries.
func (Environment) ForSubprocess ¶ added in v0.13.0
func (env Environment) ForSubprocess(base []string) []string
ForSubprocess applies the file overlay to base without replacing explicitly supplied base values. Overlay-only names are appended in sorted order for deterministic tests and command construction.
type LoadResult ¶
LoadResult describes one env-file load without exposing values.
func LoadIntoEnv ¶
func LoadIntoEnv(path string, explicit bool) (LoadResult, error)
LoadIntoEnv is retained for generated application startup compatibility. Compiler/project loading must use Load and pass the returned overlay explicitly. Existing process values always win.