all repos — flounder @ d105e77524d5c2cb84c198b364de43d0e83cb8f1

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