all repos — flounder @ 7fb04c7da9d9f530d0f0bf2b51c39c0f03a070e8

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}