bf4c289804
No config entry needs a Kind field. It is only used to determine the Go type to target. As we introduce new config entries (like this one) we can remove the kind field and have the GetKind method return the single supported value. In this case (similar to proxy-defaults) the Name field is also unnecessary. We always use the same value. So we can omit the name field entirely.
33 lines
751 B
Go
33 lines
751 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 k == "kind" || k == "Kind":
|
|
// The kind field is used to determine the target, but doesn't need
|
|
// to exist on the target.
|
|
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
|
|
}
|