2023-04-18 19:38:32 +02:00
|
|
|
package publicProxy
|
2022-09-06 21:01:38 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/michaelquigley/cf"
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Config struct {
|
2022-10-18 17:07:18 +02:00
|
|
|
Identity string
|
|
|
|
Address string
|
|
|
|
HostMatch string
|
|
|
|
}
|
|
|
|
|
2022-09-06 21:01:38 +02:00
|
|
|
func DefaultConfig() *Config {
|
|
|
|
return &Config{
|
2022-10-18 17:07:18 +02:00
|
|
|
Identity: "frontend",
|
2023-03-07 18:57:35 +01:00
|
|
|
Address: "0.0.0.0:8080",
|
2022-09-06 21:01:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|