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))
}
-
Notifications
You must be signed in to change notification settings - Fork 0
artnez/structconfig
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Use simple structs for your application config.
Topics
Resources
Stars
Watchers
Forks
Packages 0
No packages published