diff options
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/config.go | 16 | ||||
-rw-r--r-- | internal/config/cspgenerator.go | 2 |
2 files changed, 11 insertions, 7 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index b429333..7ccad85 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 { @@ -40,7 +42,8 @@ type Config struct { OriginalDomain string `toml:"original_domain"` GoatCounter URL `toml:"goatcounter"` Domains []string - OIDCHost URL `toml:"oidc_host"` + WildcardDomain string `toml:"wildcard_domain"` + OIDCHost URL `toml:"oidc_host"` Taxonomies []Taxonomy CSP *CSP `toml:"content-security-policy"` Extra struct { @@ -49,10 +52,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: diff --git a/internal/config/cspgenerator.go b/internal/config/cspgenerator.go index 40eca01..9974819 100644 --- a/internal/config/cspgenerator.go +++ b/internal/config/cspgenerator.go @@ -9,7 +9,7 @@ import ( "github.com/crewjam/csp" "github.com/fatih/structtag" - "github.com/pkg/errors" + "gitlab.com/tozd/go/errors" ) func GenerateCSP() error { |