dotnev

package
v1.6.22 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package dotnev provide load .env data to os ENV

Index

Constants

This section is empty.

Variables

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

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

	// OnlyLoadExists load on file exists
	OnlyLoadExists bool
)

Functions

func ClearLoaded added in v1.2.0

func ClearLoaded()

ClearLoaded clear the previously set ENV value

func DontUpperEnvKey added in v1.2.0

func DontUpperEnvKey()

DontUpperEnvKey dont change key to upper on set ENV

func Get

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 added in v1.2.0

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

Int get a int value by key

func Load

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

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

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

func LoadExists

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

LoadExists only load on file exists

func LoadFromMap

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

LoadFromMap load data from given string map

func LoadedData added in v1.2.0

func LoadedData() map[string]string

LoadedData get all loaded data by dontenv

Types

This section is empty.

Jump to

Keyboard shortcuts

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