agent: fix keyring loading when config is passed off

This commit is contained in:
Ryan Uber 2014-09-11 22:46:57 -07:00
parent 3e64ed70df
commit dfdd7c4ef7
1 changed files with 9 additions and 2 deletions

View File

@ -298,7 +298,7 @@ func (a *Agent) setupServer() error {
return err return err
} }
server, err := consul.NewServer(a.consulConfig()) server, err := consul.NewServer(config)
if err != nil { if err != nil {
return fmt.Errorf("Failed to start Consul server: %v", err) return fmt.Errorf("Failed to start Consul server: %v", err)
} }
@ -308,7 +308,14 @@ func (a *Agent) setupServer() error {
// setupClient is used to initialize the Consul client // setupClient is used to initialize the Consul client
func (a *Agent) setupClient() error { func (a *Agent) setupClient() error {
client, err := consul.NewClient(a.consulConfig()) config := a.consulConfig()
// Load a keyring file, if present
if err := loadKeyringFile(config.SerfLANConfig); err != nil {
return err
}
client, err := consul.NewClient(config)
if err != nil { if err != nil {
return fmt.Errorf("Failed to start Consul client: %v", err) return fmt.Errorf("Failed to start Consul client: %v", err)
} }