all repos — flounder @ a8026c9fc1d7a9c079da5cb21a8d7493199bdd69

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	Host               string
11	HttpsEnabled       bool
12	HttpPort           int
13	SiteTitle          string
14	Debug              bool
15	SecretKey          string
16	DBFile             string
17	LogFile            string
18	GeminiCertStore    string
19	CookieStoreKey     string
20	OkExtensions       []string
21	MaxFileBytes       int
22	MaxUserBytes       int64
23	TLSCertFile        string
24	TLSKeyFile         string
25}
26
27func getConfig(filename string) (Config, error) {
28	var config Config
29	// Attempt to overwrite defaults from file
30	_, err := toml.DecodeFile(filename, &config)
31	if err != nil {
32		return config, err
33	}
34	return config, nil
35}