all repos — flounder @ e8c4efc8ff0efd2f3f607384d88a92bf18e364c3

A small site builder for the Gemini protocol

config.go (view raw)

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