2019-12-10 02:26:41 +00:00
|
|
|
// +build !consulent
|
|
|
|
|
|
|
|
package config
|
|
|
|
|
2020-04-28 13:45:33 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/hashicorp/go-multierror"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
enterpriseConfigMap map[string]func(*Config) = map[string]func(c *Config){
|
|
|
|
"non_voting_server": func(c *Config) {
|
|
|
|
// to maintain existing compatibility we don't nullify the value
|
|
|
|
},
|
2020-11-17 15:53:57 +00:00
|
|
|
"read_replica": func(c *Config) {
|
|
|
|
// to maintain existing compatibility we don't nullify the value
|
|
|
|
},
|
2020-04-28 13:45:33 +00:00
|
|
|
"segment": func(c *Config) {
|
|
|
|
// to maintain existing compatibility we don't nullify the value
|
|
|
|
},
|
|
|
|
"segments": func(c *Config) {
|
|
|
|
// to maintain existing compatibility we don't nullify the value
|
|
|
|
},
|
|
|
|
"autopilot.redundancy_zone_tag": func(c *Config) {
|
|
|
|
// to maintain existing compatibility we don't nullify the value
|
|
|
|
},
|
|
|
|
"autopilot.upgrade_version_tag": func(c *Config) {
|
|
|
|
// to maintain existing compatibility we don't nullify the value
|
|
|
|
},
|
|
|
|
"autopilot.disable_upgrade_migration": func(c *Config) {
|
|
|
|
// to maintain existing compatibility we don't nullify the value
|
|
|
|
},
|
|
|
|
"dns_config.prefer_namespace": func(c *Config) {
|
|
|
|
c.DNS.PreferNamespace = nil
|
|
|
|
},
|
|
|
|
"acl.msp_disable_bootstrap": func(c *Config) {
|
|
|
|
c.ACL.MSPDisableBootstrap = nil
|
|
|
|
},
|
|
|
|
"acl.tokens.managed_service_provider": func(c *Config) {
|
|
|
|
c.ACL.Tokens.ManagedServiceProvider = nil
|
|
|
|
},
|
2020-05-11 20:27:35 +00:00
|
|
|
"audit": func(c *Config) {
|
2020-05-11 21:13:05 +00:00
|
|
|
c.Audit = nil
|
2020-05-11 20:27:35 +00:00
|
|
|
},
|
2020-04-28 13:45:33 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
type enterpriseConfigKeyError struct {
|
|
|
|
key string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e enterpriseConfigKeyError) Error() string {
|
|
|
|
return fmt.Sprintf("%q is a Consul Enterprise configuration and will have no effect", e.key)
|
|
|
|
}
|
|
|
|
|
2020-08-27 17:15:10 +00:00
|
|
|
func (*Builder) BuildEnterpriseRuntimeConfig(_ *RuntimeConfig, _ *Config) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*Builder) validateEnterpriseConfig(_ RuntimeConfig) error {
|
|
|
|
return nil
|
2019-12-10 02:26:41 +00:00
|
|
|
}
|
2020-04-28 13:45:33 +00:00
|
|
|
|
|
|
|
// validateEnterpriseConfig is a function to validate the enterprise specific
|
|
|
|
// configuration items after Parsing but before merging into the overall
|
|
|
|
// configuration. The original intent is to use it to ensure that we warn
|
|
|
|
// for enterprise configurations used in OSS.
|
|
|
|
func (b *Builder) validateEnterpriseConfigKeys(config *Config, keys []string) error {
|
|
|
|
var err error
|
|
|
|
|
|
|
|
for _, k := range keys {
|
|
|
|
if unset, ok := enterpriseConfigMap[k]; ok {
|
|
|
|
keyErr := enterpriseConfigKeyError{key: k}
|
|
|
|
|
|
|
|
b.warn(keyErr.Error())
|
|
|
|
err = multierror.Append(err, keyErr)
|
|
|
|
unset(config)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return err
|
|
|
|
}
|