Documentation
¶
Index ¶
- Variables
- func ExistEnv(key string) bool
- func ExpandValueEnv(value string) (realValue string)
- func ExpandValueEnvForMap(m map[string]interface{}) map[string]interface{}
- func GetEnv(e ...string) string
- func Home() string
- func Init() (err error)
- func IsDebug() bool
- func IsDev() bool
- func IsProd() bool
- func IsSkipErrorFile() bool
- func IsStag() bool
- func LoadFile(envFiles ...string) (err error)
- func Parse() map[string]string
- func SetDebug() error
- func SetEnv(e, v string) error
- func SetSkipErrorFile() error
Constants ¶
This section is empty.
Variables ¶
View Source
var Cfg = struct { Prefix string Home string Env string }{ Prefix: "", Home: "", Env: DevEnv.Dev, }
Cfg default config
View Source
var DevEnv = _Env{
Dev: "dev",
Stag: "stag",
Prod: "prod",
}
DevEnv program environment
Functions ¶
func ExpandValueEnv ¶ added in v0.1.10
ExpandValueEnv returns value of convert with environment variable.
Return environment variable if value start with "${" and end with "}". Return default value if environment variable is empty or not exist.
It accept value formats "${env}" , "${env||}}" , "${env||defaultValue}" , "defaultvalue". Examples:
v1 := config.ExpandValueEnv("${GOPATH}") // return the GOPATH environment variable.
v2 := config.ExpandValueEnv("${GOAsta||/usr/local/go}") // return the default value "/usr/local/go/".
v3 := config.ExpandValueEnv("Astaxie") // return the value "Astaxie".
func ExpandValueEnvForMap ¶ added in v0.1.10
ExpandValueEnvForMap convert all string value with environment variable.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.