dotenv

package
v0.21.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(environ []string, systemLookup func(string) string, noUnset bool) (map[string]string, error)

Evaluate an array of key=value strings in the dotenv syntax, and return a map of evaluated variables

func AllRaw

func AllRaw(environ []string) map[string]string

Evaluate an array of key=value strings in the dotenv syntax, in raw mode: values are left unprocessed.

func Exists

func Exists(environ []string, name string) bool

func Lookup

func Lookup(environ []string, name string, systemLookup func(string) string) (string, bool, error)

Evaluate an array of key=value strings in the dotenv syntax, and return the value of the specified variable

func LookupRaw

func LookupRaw(environ []string, name string) (string, bool)

Evaluate an array of key=value strings in the dotenv syntax, and return the value of the specified variable in raw mode

func StripExportPrefix added in v0.21.4

func StripExportPrefix(line string) string

StripExportPrefix removes an optional leading `export` keyword from a dotenv line. This is a widely supported convention (direnv, `set -a; . ./.env`, shell `source`, and most .env loaders), so `export KEY=value` is treated the same as `KEY=value`.

Types

type GraphEvaluator added in v0.19.1

type GraphEvaluator struct {
	NoUnset bool
	// contains filtered or unexported fields
}

GraphEvaluator evaluates dotenv variables with dependency resolution and cycle detection

func NewGraphEvaluator added in v0.19.1

func NewGraphEvaluator(environ []string, systemLookup func(string) string, noUnset bool) (*GraphEvaluator, error)

NewGraphEvaluator creates a new graph-based evaluator

func (*GraphEvaluator) All added in v0.19.1

func (g *GraphEvaluator) All() (map[string]string, error)

All returns all variables, expanded

func (*GraphEvaluator) Lookup added in v0.19.1

func (g *GraphEvaluator) Lookup(name string) (string, bool, error)

Lookup gets the expanded value of a variable with memoization

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL