2019-12-10 02:26:41 +00:00
|
|
|
// +build !consulent
|
|
|
|
|
|
|
|
package config
|
|
|
|
|
2020-04-28 13:45:33 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2020-11-20 22:43:32 +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 validateEnterpriseConfigKeys(config *Config) []error {
|
|
|
|
var result []error
|
|
|
|
add := func(k string) {
|
|
|
|
result = append(result, enterpriseConfigKeyError{key: k})
|
2020-04-28 13:45:33 +00:00
|
|
|
}
|
2020-11-20 22:43:32 +00:00
|
|
|
|
|
|
|
if config.ReadReplica != nil {
|
|
|
|
add(`read_replica (or the deprecated non_voting_server)`)
|
|
|
|
}
|
|
|
|
if stringVal(config.SegmentName) != "" {
|
|
|
|
add("segment")
|
|
|
|
}
|
|
|
|
if len(config.Segments) > 0 {
|
|
|
|
add("segments")
|
|
|
|
}
|
|
|
|
if stringVal(config.Autopilot.RedundancyZoneTag) != "" {
|
|
|
|
add("autopilot.redundancy_zone_tag")
|
|
|
|
}
|
|
|
|
if stringVal(config.Autopilot.UpgradeVersionTag) != "" {
|
|
|
|
add("autopilot.upgrade_version_tag")
|
|
|
|
}
|
|
|
|
if config.Autopilot.DisableUpgradeMigration != nil {
|
|
|
|
add("autopilot.disable_upgrade_migration")
|
|
|
|
}
|
|
|
|
if config.DNS.PreferNamespace != nil {
|
|
|
|
add("dns_config.prefer_namespace")
|
|
|
|
config.DNS.PreferNamespace = nil
|
|
|
|
}
|
|
|
|
if config.ACL.MSPDisableBootstrap != nil {
|
|
|
|
add("acl.msp_disable_bootstrap")
|
|
|
|
config.ACL.MSPDisableBootstrap = nil
|
|
|
|
}
|
|
|
|
if len(config.ACL.Tokens.ManagedServiceProvider) > 0 {
|
|
|
|
add("acl.tokens.managed_service_provider")
|
|
|
|
config.ACL.Tokens.ManagedServiceProvider = nil
|
|
|
|
}
|
|
|
|
if config.Audit != nil {
|
|
|
|
add("audit")
|
|
|
|
config.Audit = nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return result
|
|
|
|
}
|
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
|
|
|
}
|