config and templates

This commit is contained in:
Bronku 2025-08-06 22:51:50 +02:00
parent cdf42b7ff3
commit fb22f599ad
22 changed files with 816 additions and 38 deletions

31
config.go Normal file
View file

@ -0,0 +1,31 @@
package main
import (
_ "embed"
"time"
"github.com/BurntSushi/toml"
)
//go:embed config.default.toml
var defaultConfig string
var config struct {
Database struct {
File string
}
Server struct {
Addr string
ReadHeaderTimeout time.Duration
RequestTimeout time.Duration
}
}
func loadConfig() {
_, err := toml.Decode(defaultConfig, &config)
if err != nil {
panic(err)
}
_, _ = toml.DecodeFile("config.toml", &config)
}