From 0952535e3316bfa464cb759686568aa14926be3e Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Thu, 11 Sep 2014 22:46:57 -0700 Subject: [PATCH] agent: fix keyring loading when config is passed off --- command/agent/agent.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/command/agent/agent.go b/command/agent/agent.go index 781ecc90a0..06aad6d433 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -298,7 +298,7 @@ func (a *Agent) setupServer() error { return err } - server, err := consul.NewServer(a.consulConfig()) + server, err := consul.NewServer(config) if err != nil { 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 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 { return fmt.Errorf("Failed to start Consul client: %v", err) }