dotenv

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFiles

func LoadFiles(root string, mode Mode) error

LoadFiles loads `.env` then `.env.local` from root (when present), applying keys to the process env according to mode.

The loader never prints values. Errors are designed to avoid leaking secret material: they include filename and line number, but not the raw line.

Types

type Mode

type Mode int

Mode controls how dotenv values are applied to the current process env.

const (
	// ModePreserve loads dotenv files but does not overwrite environment variables
	// that are already set in the current process.
	ModePreserve Mode = iota

	// ModeOverride loads dotenv files and overwrites any already-set environment
	// variables in the current process.
	ModeOverride

	// ModeOff disables dotenv loading entirely.
	ModeOff
)

func ParseMode

func ParseMode(s string) (Mode, error)

Jump to

Keyboard shortcuts

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