diff options
Diffstat (limited to 'internal/config/config.go')
-rw-r--r-- | internal/config/config.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 20fe21e..cab5f90 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -3,6 +3,7 @@ package config import ( "io/fs" "log/slog" + "net/url" "github.com/BurntSushi/toml" "github.com/pkg/errors" @@ -18,9 +19,18 @@ type MenuItem struct { URL string `toml:"url"` } +type URL struct { + *url.URL +} + +func (u *URL) UnmarshalText(text []byte) (err error) { + u.URL, err = url.Parse(string(text)) + return err +} + type Config struct { DefaultLanguage string `toml:"default_language"` - BaseURL string `toml:"base_url"` + BaseURL URL `toml:"base_url"` RedirectOtherHostnames bool `toml:"redirect_other_hostnames"` Title string Email string |