config.go (view raw)
1package main
2
3import (
4 "github.com/BurntSushi/toml"
5)
6
7type Config struct {
8 FilesDirectory string
9 RootDomain string
10 SiteTitle string
11 Debug bool
12 SecretKey string
13 PasswdFile string
14}
15
16func getConfig(filename string) (Config, error) {
17 var config Config
18 // Attempt to overwrite defaults from file
19 _, err := toml.DecodeFile(filename, &config)
20 if err != nil {
21 return config, err
22 }
23 return config, nil
24}