Skip to content

artnez/structconfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

package main

import (
  "log"
  "os"

  "github.com/artnez/structconfig"
)

type Config struct {
  ServerHost string  `env:"SERVER_HOST"`
  ServerPort int     `env:"SERVER_PORT"`
  Timeout    float64 `env:"TIMEOUT"`
}

func main() {
  config := &Config{
    ServerHost: "localhost",
    ServerPort: 5000,
  }
  structconfig.FromEnviron(config, os.Environ())
  log.Printf("[config] %s", structconfig.String(config))
}

About

Use simple structs for your application config.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages