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))
}
artnez/structconfig
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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