mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-11 00:57:00 +02:00
* add config changes for name and priority fields in seal stanza * change env vars and fix tests * add header and fix func call * tweak limits on seals * fix missing import * add docstrings
56 lines
985 B
Go
56 lines
985 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
//go:build !enterprise
|
|
|
|
package server
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
|
|
"github.com/hashicorp/hcl/hcl/ast"
|
|
)
|
|
|
|
type entConfig struct{}
|
|
|
|
func (ec *entConfig) parseConfig(list *ast.ObjectList) error {
|
|
return nil
|
|
}
|
|
|
|
func (ec entConfig) Merge(ec2 entConfig) entConfig {
|
|
result := entConfig{}
|
|
return result
|
|
}
|
|
|
|
func (ec entConfig) Sanitized() map[string]interface{} {
|
|
return nil
|
|
}
|
|
|
|
func (c *Config) checkSealConfig() error {
|
|
if len(c.Seals) == 0 {
|
|
return nil
|
|
}
|
|
|
|
if len(c.Seals) > 2 {
|
|
return fmt.Errorf("seals: at most 2 seals can be provided: received %d", len(c.Seals))
|
|
}
|
|
|
|
disabledSeals := 0
|
|
for _, seal := range c.Seals {
|
|
if seal.Disabled {
|
|
disabledSeals++
|
|
}
|
|
}
|
|
|
|
if len(c.Seals) > 1 && disabledSeals == len(c.Seals) {
|
|
return errors.New("seals: seals provided but all are disabled")
|
|
}
|
|
|
|
if disabledSeals < len(c.Seals)-1 {
|
|
return errors.New("seals: only one seal can be enabled")
|
|
}
|
|
|
|
return nil
|
|
}
|