about summary refs log tree commit diff stats
path: root/internal/config/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config/config.go')
-rw-r--r--internal/config/config.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 7d43462..47d5de8 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -3,10 +3,12 @@ package config
 import (
 	"io/fs"
 	"net/url"
-	"website/internal/log"
+	"path/filepath"
+
+	"go.alanpearce.eu/x/log"
 
 	"github.com/BurntSushi/toml"
-	"github.com/pkg/errors"
+	"gitlab.com/tozd/go/errors"
 )
 
 type Taxonomy struct {
@@ -38,6 +40,7 @@ type Config struct {
 	Description      string
 	DomainStartDate  string `toml:"domain_start_date"`
 	OriginalDomain   string `toml:"original_domain"`
+	GoatCounter      URL    `toml:"goatcounter"`
 	Domains          []string
 	OIDCHost         URL `toml:"oidc_host"`
 	Taxonomies       []Taxonomy
@@ -48,10 +51,11 @@ type Config struct {
 	Menus map[string][]MenuItem
 }
 
-func GetConfig() (*Config, error) {
+func GetConfig(dir string, log *log.Logger) (*Config, error) {
 	config := Config{}
-	log.Debug("reading config.toml")
-	_, err := toml.DecodeFile("config.toml", &config)
+	filename := filepath.Join(dir, "config.toml")
+	log.Debug("reading config", "filename", filename)
+	_, err := toml.DecodeFile(filename, &config)
 	if err != nil {
 		switch t := err.(type) {
 		case *fs.PathError: