dotnev

package
v2.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: MIT Imports: 1 Imported by: 0

README

Dotenv

Package dotenv that supports importing data from files (eg .env) to ENV

Usage

err := dotenv.Load("./", ".env")
// err := dotenv.LoadExists("./", ".env")

val := dotenv.Get("ENV_KEY")
// Or use 
// val := os.Getenv("ENV_KEY")

// with default value
val := dotenv.Get("ENV_KEY", "default value")

Documentation

Overview

Package dotnev provide load .env data to os ENV

Deprecated: please use github.com/gookit/ini/v2/dotenv

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool added in v2.1.0

func Bool(name string, defVal ...bool) (val bool)

Bool get a bool value by key Deprecated: please use github.com/gookit/ini/v2/dotenv

func ClearLoaded added in v2.0.11

func ClearLoaded()

ClearLoaded clear the previously set ENV value Deprecated: please use github.com/gookit/ini/v2/dotenv

func DontUpperEnvKey added in v2.0.11

func DontUpperEnvKey()

DontUpperEnvKey don't change key to upper on set ENV Deprecated: please use github.com/gookit/ini/v2/dotenv

func Get added in v2.0.9

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

Get get os ENV value by name Deprecated: please use github.com/gookit/ini/v2/dotenv

func Int added in v2.0.11

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

Int get a int value by key Deprecated: please use github.com/gookit/ini/v2/dotenv

func Load deprecated

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

Load parse .env file data to os ENV.

Usage:

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

Deprecated: please use github.com/gookit/ini/v2/dotenv

func LoadExists

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

LoadExists only load on file exists Deprecated: please use github.com/gookit/ini/v2/dotenv

func LoadFromMap

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

LoadFromMap load data from given string map Deprecated: please use github.com/gookit/ini/v2/dotenv

func LoadedData added in v2.0.11

func LoadedData() map[string]string

LoadedData get all loaded data by dontenv Deprecated: please use github.com/gookit/ini/v2/dotenv

Types

This section is empty.

Jump to

Keyboard shortcuts

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