getenv

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// NoValue is used if requested ENV var doesn't exist
	NoValue = ""
	// CwdFailureError signals that the current working directory can not be determined
	CwdFailureError = 1
	// CantAccessEnvFileError signals that the env file exists but can not be accessed
	CantAccessEnvFileError = 2
	// NoEnvFileError signals that no env file exists in any of the parent directories
	NoEnvFileError = 3
	// CantLoadEnvFileError signals that the env file exists and can be accessed but not parsed and exported
	CantLoadEnvFileError = 4
	// NoSuchEnvVarError signals that the requested ENV var doesn't exist
	NoSuchEnvVarError = 5
)

Variables

This section is empty.

Functions

func GetEnv

func GetEnv(key string) (string, error)

GetEnv returns requested ENV variable.

func Init

func Init() error

Init looks for ENV file and extracts ENV variables from it.

func InitFromFile

func InitFromFile(filename string) error

InitFromFile looks for custom ENV file and extracts ENV variables from it.

Types

type Error

type Error struct {
	Code int
	Err  error
}

Error is a custom error type which provides useful error codes

func (*Error) Error

func (err *Error) Error() string

Jump to

Keyboard shortcuts

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