diff options
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/config.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index b429333..ca4782d 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -3,6 +3,7 @@ package config import ( "io/fs" "net/url" + "path/filepath" "website/internal/log" "github.com/BurntSushi/toml" @@ -49,10 +50,11 @@ type Config struct { Menus map[string][]MenuItem } -func GetConfig() (*Config, error) { +func GetConfig(dir string) (*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: |