Documentation ¶
Index ¶
- Constants
- Variables
- func Clear()
- func Expand(data string) string
- func ExpandEnv(value string) string
- func Get(val *string, names ...string)
- func GetEnv(names ...string) string
- func GetSys(val *string, names ...string)
- func GetSysEnv(names ...string) string
- func Lookup(key string) (string, bool)
- func Set(key, value string) error
- func SetSys(key, value string) error
- func TrimPrefix(key string) string
- func Unsetenv(key string) error
- func WithPrefix(key string) string
- type Env
Constants ¶
View Source
const DefaultSecret = "zpCjWPsbqK@@^hR01qLDmZcXhKRIZgjHfxSG2KA%J#bFp!7YQVSmzXGc!sE!^qSM7@&d%oXHQtpR7K*8eRTdhRKjaxF#t@bd#A!"
Variables ¶
View Source
var Prefix = ""
Functions ¶
func Expand ¶
Expand replaces ${var} or $var in the string according to the values of the current environment variables. References to undefined variables are replaced by the empty string.
func ExpandEnv ¶
ExpandEnv 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 TrimPrefix ¶
func WithPrefix ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.