Skip to content

darkhelmet/env

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

env

Easy environment variables for Go

Usage

import "github.com/darkhelmet/env"

...

s := env.String("USER") // Will panic if USER is not present
sd := env.StringDefault("KEY", "It-Not-Present")
sdf := env.StringDefaultF("KEY", func() string { return "do something tough" })

// Similarly for int and float

env.Int("N") // Panic if not present
env.IntDefault("N", 1)
env.IntDefaultF("N", func() int { return 5 })

env.Float("F") // Panic if not present
env.FloatDefault("F", 1.0)
env.FloatDefaultF("F", func() float64 { return 5.5 })

License

Apache 2.0, see LICENSE.md

About

Easy environment variables for Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •