mirror of
https://github.com/status-im/consul.git
synced 2025-01-22 11:40:06 +00:00
Prevent partition-exports entry from OSS usage
Validation was added on the config entry kind since that is called when validating config entries to bootstrap via agent configuration and when applying entries via the config RPC endpoint.
This commit is contained in:
parent
52f0853ff9
commit
5e1f7b7c36
@ -113,7 +113,12 @@ func (e *PartitionExportsConfigEntry) Validate() error {
|
||||
return fmt.Errorf("partition-exports Name must be the name of a partition, and not a wildcard")
|
||||
}
|
||||
|
||||
validationErr := validateConfigEntryMeta(e.Meta)
|
||||
if err := requireEnterprise(e.GetKind()); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validateConfigEntryMeta(e.Meta); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, svc := range e.Services {
|
||||
if svc.Name == "" {
|
||||
@ -128,8 +133,7 @@ func (e *PartitionExportsConfigEntry) Validate() error {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return validationErr
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *PartitionExportsConfigEntry) CanRead(authz acl.Authorizer) bool {
|
||||
|
@ -35,3 +35,7 @@ func validateUnusedKeys(unused []string) error {
|
||||
func validateInnerEnterpriseMeta(_, _ *EnterpriseMeta) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func requireEnterprise(kind string) error {
|
||||
return fmt.Errorf("Config entry kind %q requires Consul Enterprise", kind)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user