genv: github.com/sakirsensoy/genv Index | Files | Directories

package genv

import "github.com/sakirsensoy/genv"

Package genv is a library for Go (golang) that makes it easy to read and use environment variables in your projects. It also allows environment variables to be loaded from the .env file.

Index

Package Files

genv.go

Variables

var EnvVariables = make(map[string]*EnvVariable)

EnvVariables is where environment variables are stored.

type EnvVariable Uses

type EnvVariable struct {
    Key          string
    Val          string
    DefaultValue interface{}
    IsDefined    bool
}

EnvVariable contains information about the environment variable, such as key, value, and default value.

func Key Uses

func Key(key string) *EnvVariable

Key is used to determine the path of the environment variable to be accessed.

genv.Key("env-key").String()

func (*EnvVariable) Bool Uses

func (e *EnvVariable) Bool() bool

Bool method is used for environment variables of type bool.

genv.Key("env-key").Bool()

func (*EnvVariable) Default Uses

func (e *EnvVariable) Default(defaultValue interface{}) *EnvVariable

Default is used to specify the default value for the environment variable to be accessed.

genv.Key("env-key").Default("defaultValue").String()

func (*EnvVariable) Float Uses

func (e *EnvVariable) Float() float64

Float method is used for environment variables of type float.

genv.Key("env-key").Float()

func (*EnvVariable) Int Uses

func (e *EnvVariable) Int() int

Int method is used for environment variables of type int.

genv.Key("env-key").Int()

func (*EnvVariable) String Uses

func (e *EnvVariable) String() string

String method is used for environment variables of type string.

genv.Key("env-key").String()

func (*EnvVariable) Update Uses

func (e *EnvVariable) Update(value interface{})

Update is used to update the value of the corresponding environment variable.

genv.Key("env-key").Update("updatedValue")

Directories

PathSynopsis
dotenv
dotenv/autoload

Package genv imports 2 packages (graph). Updated 2019-07-28. Refresh now. Tools for package owners.