package config import ( "os" "encoding/json" ) type User struct { Name string PasswordHash []byte Salt []byte } type Endpoint struct { Path string Address string } type Config struct { ListenAddress string PathPrefix string AssetDirectory string LoginTimeout int Users []User Endpoints []Endpoint } type Api struct { Prefix string Login string Logout string Asset string } func Load(filename string) (Config, error) { blob, err := os.ReadFile(filename) if err != nil { return Config{}, err } config := Config{} err = json.Unmarshal(blob, &config) if err != nil { return Config{}, err } return config, nil }