Skip to content

colindev/osenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

env loader

load os env to struct

PayPal donate button Build Status GoDoc

Example

package main

type Env struct {
    Path string `env:"PATH"`
    User string `env:"USER"`
    DefaultValue bool `env:"DV,true"`
    CustomInt int `env:"custom_int"`
    Omit map[string]interface{} `env:"-"`
}

func init(){
    os.Setenv("custom_int", "123")
}

func main(){
    var env Env
    if err := osenv.LoadTo(&env); err != nil {
        log.Fatal(err)
    }

    fmt.Println(env)
}

About

golang package for load os env to struct

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages