Documentation ¶
Index ¶
- Variables
- func DefaultPaths() []string
- func EnvFileToJSONFile(data any, filepathENV, filepathJSON string, perm os.FileMode, ...) error
- func GetDotEnvVal(envPath, varName string) (string, error)
- func JoinEnvNumbered(prefix, delimiter string, startInt uint8, includeBase bool) string
- func LoadDotEnv(paths []string, n int) ([]string, error)
- func LoadEnvPathsPrioritized(fixedPath, envPath string) error
Constants ¶
This section is empty.
Variables ¶
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 ¶
GetDotEnvVal retrieves a single var from a `.env` file path
func JoinEnvNumbered ¶
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 ¶
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 ¶
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.
Types ¶
This section is empty.