all repos — homestead @ 2d8ae277e25117ab59eeb95c6ed25b34bcd75e4f

Code for my website

add two-week availability calendar

Alan Pearce
commit

2d8ae277e25117ab59eeb95c6ed25b34bcd75e4f

parent

0296be4cbce9b13896dd703e868029672e55fd8c

1 file changed, 26 insertions(+), 10 deletions(-)

changed files
M internal/config/config.gointernal/config/config.go
@@ -4,6 +4,7 @@ import (
"io/fs" "net/url" "path/filepath" + "time" "go.alanpearce.eu/x/log"
@@ -40,21 +41,36 @@
return errors.WithMessagef(err, "could not parse URL %s", string(text)) } +type Timezone struct { + *time.Location +} + +func (t *Timezone) UnmarshalText(text []byte) (err error) { + t.Location, err = time.LoadLocation(string(text)) + + return errors.WithMessagef(err, "could not parse timezone %s", string(text)) +} + type Config struct { - Language string `toml:"language"` + Title string + Email string + Description string + BaseURL URL `toml:"base_url"` - Title string - Email string - Description string + OriginalDomain string `toml:"original_domain"` DomainStartDate string `toml:"domain_start_date"` - OriginalDomain string `toml:"original_domain"` GoatCounter URL `toml:"goatcounter"` - Domains []string - WildcardDomain string `toml:"wildcard_domain"` OIDCHost URL `toml:"oidc_host"` - Taxonomies []Taxonomy - Menu []MenuItem - RelMe []MenuItem `toml:"rel_me"` + + Domains []string + WildcardDomain string `toml:"wildcard_domain"` + + Language string + Timezone Timezone + + Taxonomies []Taxonomy + Menu []MenuItem + RelMe []MenuItem `toml:"rel_me"` } func GetConfig(dir string, log *log.Logger) (*Config, errors.E) {