Popularity
1.2
Growing
Activity
0.0
Declining
10
2
3

Programming language: Go
License: MIT License
Tags: Configuration    
Latest version: v1.2.0

nasermirzaei89/env alternatives and similar packages

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

Do you think we are missing an alternative of nasermirzaei89/env or a related project?

Add another 'Configuration' Package

README

Env

Golang Get Environment Variables Package

Build Status Go Report Card GolangCI Codecov GoDoc license

Install

go get github.com/nasermirzaei89/env

Sample Usage

With default value

package main

import (
    "fmt"
    "github.com/nasermirzaei89/env"
)

func main()  {
    var b  = env.GetBool("A", true)
    fmt.Println(b) // true (default)

    var f  = env.GetFloat("B", 14.5)
    fmt.Println(f) // 14.5 (default)

    var i  = env.GetInt("C", 12)
    fmt.Println(i) // 12 (default)

    var s  = env.GetString("B", "hi")
    fmt.Println(s) // hi (default)
}

Force setting environment

package main

import (
    "fmt"
    "github.com/nasermirzaei89/env"
)

func main()  {
    var s  = env.MustGetString("HOME")
    fmt.Println(s) // /Users/nasermirzaei89

    s  = env.MustGetString("NEW") // panics
}

Contributing

You can submit a new issue in github issues. Or you can create a fork, hack on your fork and when you're done create a pull request, so that the code contribution can get merged into the main package.


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