mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 17:52:32 +00:00
VAULT-6368 Metrics-only listener for Agent (#18101)
* VAULT-6368 Metrics-only listener for Agent * VAULT-6368 changelog * VAULT-6368 Update config to use string instead of bool * VAULT-6368 Fix leftover code * VAULT-6368 Fix changelog * VAULT-6368 fix typo * VAULT-6368 recommended doc update * VAULT-6368 use != over !(==)
This commit is contained in:
@@ -2,7 +2,6 @@ package configutil
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/go-secure-stdlib/parseutil"
|
||||
@@ -47,25 +46,6 @@ type SharedConfig struct {
|
||||
ClusterName string `hcl:"cluster_name"`
|
||||
}
|
||||
|
||||
// LoadConfigFile loads the configuration from the given file.
|
||||
func LoadConfigFile(path string) (*SharedConfig, error) {
|
||||
// Read the file
|
||||
d, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ParseConfig(string(d))
|
||||
}
|
||||
|
||||
func LoadConfigKMSes(path string) ([]*KMS, error) {
|
||||
// Read the file
|
||||
d, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ParseKMSes(string(d))
|
||||
}
|
||||
|
||||
func ParseConfig(d string) (*SharedConfig, error) {
|
||||
// Parse!
|
||||
obj, err := hcl.Parse(d)
|
||||
|
||||
@@ -44,6 +44,7 @@ type Listener struct {
|
||||
Type string
|
||||
Purpose []string `hcl:"-"`
|
||||
PurposeRaw interface{} `hcl:"purpose"`
|
||||
Role string `hcl:"role"`
|
||||
|
||||
Address string `hcl:"address"`
|
||||
ClusterAddress string `hcl:"cluster_address"`
|
||||
@@ -182,6 +183,13 @@ func ParseListeners(result *SharedConfig, list *ast.ObjectList) error {
|
||||
|
||||
l.PurposeRaw = nil
|
||||
}
|
||||
|
||||
switch l.Role {
|
||||
case "default", "metrics_only", "":
|
||||
result.found(l.Type, l.Type)
|
||||
default:
|
||||
return multierror.Prefix(fmt.Errorf("unsupported listener role %q", l.Role), fmt.Sprintf("listeners.%d:", i))
|
||||
}
|
||||
}
|
||||
|
||||
// Request Parameters
|
||||
|
||||
Reference in New Issue
Block a user