env

package
v0.3.32 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Prefix string

环境变量的前缀

Functions

func Expand

func Expand(value string) string

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 Get

func Get(names ...string) string

func GetVal

func GetVal(val *string, names ...string)

func List

func List() map[string]string

func Lookup

func Lookup(key string) (string, bool)

func Set

func Set(key, value string) error

func Unsetenv

func Unsetenv(key string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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