about summary refs log tree commit diff stats
path: root/internal/config/config.go
diff options
context:
space:
mode:
authorAlan Pearce2024-04-15 08:55:53 +0200
committerAlan Pearce2024-04-16 18:10:12 +0200
commit56b0df9e6c84bbcdaffbde50632e7fdd992791e5 (patch)
tree700639888cd43c0c0181bffd2cb09a3e9f4fb27a /internal/config/config.go
parent42a838666aa9da0799dcd3c3d9c6ad0344d1e8d6 (diff)
downloadwebsite-56b0df9e6c84bbcdaffbde50632e7fdd992791e5.tar.lz
website-56b0df9e6c84bbcdaffbde50632e7fdd992791e5.tar.zst
website-56b0df9e6c84bbcdaffbde50632e7fdd992791e5.zip
wip: render feeds
Diffstat (limited to 'internal/config/config.go')
-rw-r--r--internal/config/config.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
new file mode 100644
index 0000000..aa46e6a
--- /dev/null
+++ b/internal/config/config.go
@@ -0,0 +1,37 @@
+package config
+
+import (
+	"github.com/BurntSushi/toml"
+)
+
+type Taxonomy struct {
+	Name string
+	Feed bool
+}
+
+type MenuItem struct {
+	Name string
+	URL  string `toml:"url"`
+}
+
+type Config struct {
+	DefaultLanguage        string `toml:"default_language"`
+	BaseURL                string `toml:"base_url"`
+	RedirectOtherHostnames bool   `toml:"redirect_other_hostnames"`
+	Title                  string
+	Email                  string
+	Description            string
+	DomainStartDate        string `toml:"domain_start_date"`
+	OriginalDomain         string `toml:"original_domain"`
+	Taxonomies             []Taxonomy
+	Extra                  struct {
+		Headers map[string]string
+	}
+	Menus map[string][]MenuItem
+}
+
+func GetConfig() (error, Config) {
+	config := Config{}
+	_, err := toml.DecodeFile("config.toml", &config)
+	return err, config
+}