config

package
v0.64.11 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 9 Imported by: 91

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnvPathVar = "ENV_PATH"
	LocalPath  = "./.env"
)

Functions

func DefaultPaths

func DefaultPaths() []string

func EnvFileToJSONFile

func EnvFileToJSONFile(data any, filepathENV, filepathJSON string, perm os.FileMode, prefix, indent string) error

EnvFileToJSONFile Converts an .env file to a JSON file using the definition provided in data.

func GetDotEnvVal

func GetDotEnvVal(envPath, varName string) (string, error)

GetDotEnvVal retrieves a single var from a `.env` file path

func JoinEnvNumbered

func JoinEnvNumbered(prefix, delimiter string, startInt uint8, includeBase bool) string

Return a merged environment var which is split into multiple vars. This is useful when the system has a size limit on environment variables.

func LoadDotEnv

func LoadDotEnv(paths []string, n int) ([]string, error)

LoadDotEnv loads a set of `.env` files given the supplied path. If no files are supplied, it will load the files from `DefaultPaths()`. A maximum of `n` files will be loaded. If `n` is 0 or less, all files will be loaded.

func LoadEnvPathsPrioritized

func LoadEnvPathsPrioritized(fixedPath, envPath string) error

LoadEnvPaths attempts to load an explicit, env and current path. It returns an error ifexplicit/env paths are present but do not exist or are empty. This is was designed to flexibly handle common .env file paths in a prioritzed and differentiated order.

func ParseFlagsAndLoadDotEnv added in v0.63.3

func ParseFlagsAndLoadDotEnv(opts DotEnvOpts) error

Types

type DotEnvOpts added in v0.63.3

type DotEnvOpts interface {
	DotEnvFilename() string
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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