diff options
author | Alan Pearce | 2024-06-29 16:48:40 +0200 |
---|---|---|
committer | Alan Pearce | 2024-06-29 16:48:40 +0200 |
commit | b4095d108a2646bcf9e7fff64788b10d9bce8da3 (patch) | |
tree | f45554857a3128922b665ab0fb04150380c0d44e /internal/config/config.go | |
parent | e8221541404a8d2ca0758d48ba5fe9c85f9067ac (diff) | |
download | website-b4095d108a2646bcf9e7fff64788b10d9bce8da3.tar.lz website-b4095d108a2646bcf9e7fff64788b10d9bce8da3.tar.zst website-b4095d108a2646bcf9e7fff64788b10d9bce8da3.zip |
build outside of working directory
Diffstat (limited to 'internal/config/config.go')
-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: |