Skip to content

threadedstream/envs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

envs

Very simple library for setting values associated with environment variables.

Usage

Here's a simple example

package main

import(
  "github.com/ThreadedStream/envs"
  "fmt"
)

type Config struct{
  Host   string `env:"HOST"    fallback:"127.0.0.1"`
  Port   int    `env:"PORT"    fallback:"3000"`
  UseSSL bool   `env:"USE_SSL" fallback:"true"`
}

func main() { 
  var(
    c = &Config{}
    err = envs.Parse(c)
  )
  
  if err != nil{
    panic(err)
  }
  
  fmt.Printf("Host: %s, Port: %d, UseSSL: %t", c.Host, c.Port, c.UseSSL)
  
  // Host: 127.0.0.1, Port: 3000, UseSSL: true 
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages