all repos — flounder @ f0ec25f3b1de5cba69cf8ed647c9391c9b7ea81d

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	MaxFileSize        int
22	TLSCertFile        string
23	TLSKeyFile         string
24}
25
26func getConfig(filename string) (Config, error) {
27	var config Config
28	// Attempt to overwrite defaults from file
29	_, err := toml.DecodeFile(filename, &config)
30	if err != nil {
31		return config, err
32	}
33	return config, nil
34}