Skip to content

Easy getting app settings from json, environment and flags with struct tags

License

Notifications You must be signed in to change notification settings

covrom/easysettings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

easysettings

Simple getting an app settings from json (first), environment (second) and flags (third) into your struct with tags. Imports only standard libraries. Use very simple format of struct with tags for all variants of values representation:

type AppSettings struct {
	Host   string `json:"host" env:"HOST" flag:"a" help:"net interface address (127.0.0.1 for localhost only)"`
	Port   string `json:"port" env:"PORT" flag:"p" help:"port of main http server"`
	APIKey string `json:"apikey" env:"APIKEY" flag:"apikey" help:"key for API access"`
}

Sample usage:

go get github.com/covrom/easysettings
go build .
./easysettings.exe -h
./easysettings.exe -newkey
HOST=127.0.0.1 ./easysettings.exe -h

About

Easy getting app settings from json, environment and flags with struct tags

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages