mirror of
https://github.com/hashicorp/vault.git
synced 2026-04-26 00:30:11 -04:00
command/server: config for setting stats addresses
This commit is contained in:
parent
b5fbc293b3
commit
75a319d767
3 changed files with 14 additions and 4 deletions
|
|
@ -14,10 +14,10 @@ import (
|
|||
|
||||
// Config is the configuration for the vault server.
|
||||
type Config struct {
|
||||
Listeners []*Listener
|
||||
Backend *Backend
|
||||
StatsiteAddr string // TODO: Parse this
|
||||
StatsdAddr string // TODO: Parse this
|
||||
Listeners []*Listener `hcl:"-"`
|
||||
Backend *Backend `hcl:"-"`
|
||||
StatsiteAddr string `hcl:"statsite_addr"`
|
||||
StatsdAddr string `hcl:"statsd_addr"`
|
||||
}
|
||||
|
||||
// DevConfig is a Config that is used for dev mode of Vault.
|
||||
|
|
@ -114,6 +114,10 @@ func LoadConfigFile(path string) (*Config, error) {
|
|||
|
||||
// Start building the result
|
||||
var result Config
|
||||
if err := hcl.DecodeObject(&result, obj); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if objs := obj.Get("listener", false); objs != nil {
|
||||
result.Listeners, err = loadListeners(objs)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ func TestLoadConfigFile(t *testing.T) {
|
|||
"foo": "bar",
|
||||
},
|
||||
},
|
||||
|
||||
StatsiteAddr: "foo",
|
||||
StatsdAddr: "bar",
|
||||
}
|
||||
if !reflect.DeepEqual(config, expected) {
|
||||
t.Fatalf("bad: %#v", config)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
statsd_addr = "bar"
|
||||
statsite_addr = "foo"
|
||||
|
||||
listener "tcp" {
|
||||
address = "127.0.0.1:443"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue