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 DBFile string
14 PasswdFile string // TODO remove
15}
16
17func getConfig(filename string) (Config, error) {
18 var config Config
19 // Attempt to overwrite defaults from file
20 _, err := toml.DecodeFile(filename, &config)
21 if err != nil {
22 return config, err
23 }
24 return config, nil
25}