zenv

package
v0.12.5 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Set

func Set(val interface{}, config *EnvOptions, paths ...string) error

Set non-zero values on a struct using reflection to parse values from os.Environ() followed by parsing values from any provided .env files. Existing values will not be overwritten if the same key is encountered later. If a file doesn't exist it will be skipped.

func SetFiles

func SetFiles(val interface{}, config *EnvOptions, paths ...string) error

Set non-zero values on a struct using reflect to parse values from .env files. This method has the same behavior as Set, but doesn't use os.Environ() at all.

func SetMap

func SetMap(val reflect.Value, config EnvOptions, env EnvMap, prefix string) (err error)

Set non-zero values on a struct using reflect to get values from a map

Types

type EnvMap

type EnvMap = map[string]string

func ParseEnvFile

func ParseEnvFile(path string) (EnvMap, error)

Parse a single env file using godotenv.Parse

func ParseFiles

func ParseFiles(paths ...string) (env EnvMap, err error)

Parse multiple env files and merge the results into a single map. Existing values are skipped when merging. This defines the precedence as left to right.

type EnvOptions added in v0.8.12

type EnvOptions struct {
	Overwrite bool
}

Jump to

Keyboard shortcuts

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