Properly scope config objects for reloading
This commit is contained in:
parent
84af6ec8ac
commit
b3218d26d6
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
auditFile "github.com/hashicorp/vault/builtin/audit/file"
|
||||
auditSyslog "github.com/hashicorp/vault/builtin/audit/syslog"
|
||||
"github.com/hashicorp/vault/command/server"
|
||||
"github.com/hashicorp/vault/version"
|
||||
|
||||
credAppId "github.com/hashicorp/vault/builtin/credential/app-id"
|
||||
|
@ -78,8 +79,9 @@ func Commands(metaPtr *command.Meta) map[string]cli.CommandFactory {
|
|||
"mysql": mysql.Factory,
|
||||
"ssh": ssh.Factory,
|
||||
},
|
||||
ShutdownCh: makeShutdownCh(),
|
||||
SighupCh: makeSighupCh(),
|
||||
ShutdownCh: makeShutdownCh(),
|
||||
SighupCh: makeSighupCh(),
|
||||
ReloadFuncs: map[string][]server.ReloadFunc{},
|
||||
}, nil
|
||||
},
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ type ServerCommand struct {
|
|||
|
||||
Meta
|
||||
|
||||
ReloadFuncs []server.ReloadFunc
|
||||
ReloadFuncs map[string][]server.ReloadFunc
|
||||
}
|
||||
|
||||
func (c *ServerCommand) Run(args []string) int {
|
||||
|
@ -302,7 +302,9 @@ func (c *ServerCommand) Run(args []string) int {
|
|||
lns = append(lns, ln)
|
||||
|
||||
if reloadFunc != nil {
|
||||
c.ReloadFuncs = append(c.ReloadFuncs, reloadFunc)
|
||||
relSlice := c.ReloadFuncs["listener|"+lnConfig.Type]
|
||||
relSlice = append(relSlice, reloadFunc)
|
||||
c.ReloadFuncs["listener|"+lnConfig.Type] = relSlice
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -575,9 +577,9 @@ func (c *ServerCommand) Reload(configPath []string) error {
|
|||
|
||||
var reloadErrors *multierror.Error
|
||||
// Call reload on the listeners. This will call each listener with each
|
||||
// config block, but they verify the ID.
|
||||
// config block, but they verify the address.
|
||||
for _, lnConfig := range config.Listeners {
|
||||
for _, relFunc := range c.ReloadFuncs {
|
||||
for _, relFunc := range c.ReloadFuncs["listener|"+lnConfig.Type] {
|
||||
if err := relFunc(lnConfig.Config); err != nil {
|
||||
retErr := fmt.Errorf("Error encountered reloading configuration: %s", err)
|
||||
reloadErrors = multierror.Append(retErr)
|
||||
|
|
Loading…
Reference in New Issue