7 "github.com/BurntSushi/toml"
10 type tomlConfig struct {
13 DB database `toml:"database"`
14 Servers map[string]server
18 type ownerInfo struct {
20 Org string `toml:"organization"`
25 type database struct {
28 ConnMax int `toml:"connection_max"`
44 if _, err := toml.DecodeFile("example.toml", &config); err != nil {
49 fmt.Printf("Title: %s\n", config.Title)
50 fmt.Printf("Owner: %s (%s, %s), Born: %s\n",
51 config.Owner.Name, config.Owner.Org, config.Owner.Bio,
53 fmt.Printf("Database: %s %v (Max conn. %d), Enabled? %v\n",
54 config.DB.Server, config.DB.Ports, config.DB.ConnMax,
56 for serverName, server := range config.Servers {
57 fmt.Printf("Server: %s (%s, %s)\n", serverName, server.IP, server.DC)
59 fmt.Printf("Client data: %v\n", config.Clients.Data)
60 fmt.Printf("Client hosts: %v\n", config.Clients.Hosts)