Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 1.27 KB

README.md

File metadata and controls

40 lines (31 loc) · 1.27 KB

Sourcegraph GoDoc Go Report Card License

Installation

go get github.com/tint/env

初始化

自动检测应用目录

env.Setup()

自定义启动目录

env.Setup("path/to/directory")

获取值

  env.Lookup(name string) (val string, exists bool)
  env.Exists(name string) bool
  env.Unknown(name string, value ...interface{}) interface{}
  env.String(name string, value ...string) string
  env.Bytes(name string, value ...[]byte) []byte
  env.Int(name string, value ...int) int
  env.Duration(name string, value ...time.Duration) time.Duration
  env.Bool(name string, value ...bool) bool
  env.Map(prefix string) map[string]string
  env.Where(filter func(name string, value string) bool) map[string]string
  env.Environ() []string