6ef032fefe
Split up unused key validation in config entry decode for oss/ent. This is needed so that we can return an informative error in OSS if namespaces are provided.
30 lines
615 B
Go
30 lines
615 B
Go
// +build !consulent
|
|
|
|
package structs
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/hashicorp/go-multierror"
|
|
)
|
|
|
|
func (e *ProxyConfigEntry) validateEnterpriseMeta() error {
|
|
return nil
|
|
}
|
|
|
|
func validateUnusedKeys(unused []string) error {
|
|
var err error
|
|
|
|
for _, k := range unused {
|
|
switch {
|
|
case k == "CreateIndex" || k == "ModifyIndex":
|
|
case strings.HasSuffix(strings.ToLower(k), "namespace"):
|
|
err = multierror.Append(err, fmt.Errorf("invalid config key %q, namespaces are a consul enterprise feature", k))
|
|
default:
|
|
err = multierror.Append(err, fmt.Errorf("invalid config key %q", k))
|
|
}
|
|
}
|
|
return err
|
|
}
|