zrok/endpoints/frontend/config.go

29 lines
548 B
Go
Raw Normal View History

package frontend
import (
"github.com/michaelquigley/cf"
"github.com/pkg/errors"
)
type Config struct {
2022-10-14 21:38:09 +02:00
Identity string
MetricsService string
Address string
HostMatch string
}
func DefaultConfig() *Config {
return &Config{
2022-10-14 21:38:09 +02:00
Identity: "frontend",
MetricsService: "metrics",
Address: "0.0.0.0:8080",
}
}
func (c *Config) Load(path string) error {
if err := cf.BindYaml(c, path, cf.DefaultOptions()); err != nil {
return errors.Wrapf(err, "error loading frontend config '%v'", path)
}
return nil
}