configuration versioning (#118)

This commit is contained in:
Michael Quigley 2022-12-01 13:40:57 -05:00
parent 758011d0c0
commit b4f85e711f
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 8 additions and 0 deletions

View File

@ -6,7 +6,10 @@ import (
"github.com/pkg/errors"
)
const ConfigVersion = 1
type Config struct {
V int
Endpoint *EndpointConfig
Proxy *ProxyConfig
Email *EmailConfig
@ -61,5 +64,8 @@ func LoadConfig(path string) (*Config, error) {
if err := cf.BindYaml(cfg, path, cf.DefaultOptions()); err != nil {
return nil, errors.Wrapf(err, "error loading controller config '%v'", path)
}
if cfg.V != ConfigVersion {
return nil, errors.Errorf("expecting configuration version '%v', your configuration is version '%v'; please see zrok.io for changelog and configuration documentation", ConfigVersion, cfg.V)
}
return cfg, nil
}

View File

@ -4,6 +4,8 @@
# /___|_| \___/|_|\_\
# controller configuration
v: 1
endpoint:
host: 0.0.0.0
port: 18080