config: github.com/gookit/config/dotnev Index | Files

package dotnev

import "github.com/gookit/config/dotnev"

Package dotnev provide load .env data to os ENV

Index

Package Files

dotenv.go

Variables

var (
    // UpperEnvKey change key to upper on set ENV
    UpperEnvKey = true

    // DefaultName default file name
    DefaultName = ".env"

    // OnlyLoadExists load on file exists
    OnlyLoadExists bool
)

func ClearLoaded Uses

func ClearLoaded()

ClearLoaded clear the previously set ENV value

func DontUpperEnvKey Uses

func DontUpperEnvKey()

DontUpperEnvKey dont change key to upper on set ENV

func Get Uses

func Get(name string, defVal ...string) (val string)

Get get os ENV value by name

NOTICE: if is windows OS, os.Getenv() Key is not case sensitive

func Int Uses

func Int(name string, defVal ...int) (val int)

Int get a int value by key

func Load Uses

func Load(dir string, filenames ...string) (err error)

Load parse .env file data to os ENV. Usage:

dotenv.Load("./", ".env")

func LoadExists Uses

func LoadExists(dir string, filenames ...string) error

LoadExists only load on file exists

func LoadFromMap Uses

func LoadFromMap(kv map[string]string) (err error)

LoadFromMap load data from given string map

func LoadedData Uses

func LoadedData() map[string]string

LoadedData get all loaded data by dontenv

Package dotnev imports 6 packages (graph). Updated 2019-08-16. Refresh now. Tools for package owners.