all repos — flounder @ 7068552cb491131c4b58a79149ac457333881ac5

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