Popularity
0.8
Declining
Activity
3.8
-
1
4
1

Description

Implements a simple way of handling environment values. Each environment field is simply reflected by a variable inside the Go program. Out of the box handlers for the types bool, []byte, time.Duration, int, string and []string are provided. Other types can be added by using the RegisterField function.

Programming language: Go
License: Apache License 2.0
Tags: Configuration     Go     Golang     Environment    

go-env alternatives and similar packages

Based on the "Configuration" category.
Alternatively, view go-env alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of go-env or a related project?

Add another 'Configuration' Package

README

env

GoDoc Build Status

Implements a simple way of handling environment values. Each environment field is simply reflected by a variable inside the Go program. Out of the box handlers for the types bool, []byte, time.Duration, int, []int, string and []string are provided. Other types can be added by using the RegisterField function.

Example

var (
    name = env.String("NAME", "joe")
    age  = env.Int("AGE", 24)
)

func main() {
    env.ParseFlags()

    fmt.Printf("%s is %d years old\n", name.Get(), age.Get())
}

If the program is called with -print short-bash, all registered environment fields would be printed...

NAME="joe"
AGE="24"

By using -print long-bash, a description for each field is generated.

# String field. The default value is 'joe'.
NAME="joe"

# Int field. The default value is '24'.
AGE="24"

License

The project is licensed under Apache 2.0.


*Note that all licence references and agreements mentioned in the go-env README section above are relevant to that project's source code only.