dotenv

package
v2.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFileAccessError

func IsFileAccessError(err error) (error, bool)

func IsParseError

func IsParseError(err error) (error, bool)

func ParseFiles

func ParseFiles(paths ...string) (map[string]string, error)

ParseFiles parses the provided files and returns the variables parsed.

func ParseStrings

func ParseStrings(values ...string) (map[string]string, error)

ParseStrings parses the provided strings and returns the variables parsed.

Types

type FileAccessError

type FileAccessError struct {
	Path string `json:"path"`
	Err  error  `json:"error"`
}

func (*FileAccessError) Error

func (e *FileAccessError) Error() string

func (*FileAccessError) Unwrap

func (e *FileAccessError) Unwrap() error

type ParseError

type ParseError struct {
	Content string `json:"content"`
	Line    int    `json:"line"`
	Column  int    `json:"column"`
	Err     error  `json:"error"`
}

func (*ParseError) Error

func (e *ParseError) Error() string

func (*ParseError) Unwrap

func (e *ParseError) Unwrap() error

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser is a parser for dotenv files.

func New

func New() *Parser

New creates a new Parser.

func (*Parser) ExpandVariables

func (p *Parser) ExpandVariables(maxDepth int, includeVars map[string]string)

ExpandVariables resolves ${VAR} references in the variables parsed by the Parser. ${VAR} format can be replaced in combination with any other mixed text, however, $VAR will only be replace if that's the entire value, e.g. "FOO=$VAR". Additionally, $VAR/${VAR} references in single quotes will not be replaced, which includes triple-single quote blocks.

func (*Parser) Parse

func (p *Parser) Parse(value string) error

Parse parses the provided value and stores the results in the Parser.

func (*Parser) Values

func (p *Parser) Values() map[string]string

Values returns a copy of the variables parsed by the Parser.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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