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:
Violet Hynes
2022-11-25 16:00:56 -05:00
committed by GitHub
parent c73a6a4a9e
commit a4a23f794a
9 changed files with 51 additions and 27 deletions

View File

@@ -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)

View File

@@ -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