Skip to content

go package for managing app configuration

License

Notifications You must be signed in to change notification settings

BenJoParadise/settings

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

settings

Go Report Card

A simple go package for managing configuration files.

Saves & loads configuration from files using simple interfaces.

Supported format: JSON

Usage

go get "github.com/BenJoParadise/settings"
import (
	"github.com/BenJoParadise/settings"
)

Example

const confFile = "example.conf"

func main() {
    conf := settings.New()
	err := conf.Load(confFile, settings.FormatJSON)
	if err != nil {
		log.Printf("Cannot load configuration file: %v", err)
	}
	log.Printf("App bind: %s", conf.Get("app.bind", "no bind yet"))
	conf.Set("app.bind", "0.0.0.0:8080")
	err = conf.Save(confFile, settings.FormatJSON)
	if err != nil {
		log.Fatal(err)
	}
	log.Println("Saved to ", confFile)
	conf.Print(settings.FormatJSON)
}

About

go package for managing app configuration

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 91.5%
  • Shell 8.5%