package main
import (
"github.com/pelletier/go-toml"
)
type Route struct {
Match string
Root string
}
type Domain struct {
Name string
Root string
Route []Route
}
type TLS struct {
Directory string
}
type Config struct {
Listen string
CertDir string
TLS TLS
Domain []Domain
}
func LoadConfig(file string) (*Config, error) {
c := new(Config)
tree, err := toml.LoadFile(file)
if err != nil {
return c, err
}
err = tree.Unmarshal(c)
if err != nil {
return c, err
}
return c, nil
}