From d5038f34b0ff142e439d539838183b3f9fadb1ea Mon Sep 17 00:00:00 2001 From: Evan Phoenix Date: Fri, 23 Sep 2016 07:55:51 -0700 Subject: [PATCH] Advertise the cluster_(id|name) in the Scada handshake (#1906) --- command/server.go | 9 +++++++++ command/server/listener_atlas.go | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/command/server.go b/command/server.go index b2d74331ad..1d756d972c 100644 --- a/command/server.go +++ b/command/server.go @@ -376,6 +376,15 @@ func (c *ServerCommand) Run(args []string) int { // Initialize the listeners lns := make([]net.Listener, 0, len(config.Listeners)) for i, lnConfig := range config.Listeners { + if lnConfig.Type == "atlas" { + if config.ClusterName == "" { + c.Ui.Error("cluster_name is not set in the config and is a required value") + return 1 + } + + lnConfig.Config["cluster_name"] = config.ClusterName + } + ln, props, reloadFunc, err := server.NewListener(lnConfig.Type, lnConfig.Config, logGate) if err != nil { c.Ui.Error(fmt.Sprintf( diff --git a/command/server/listener_atlas.go b/command/server/listener_atlas.go index 92f70e9bae..749cc3333b 100644 --- a/command/server/listener_atlas.go +++ b/command/server/listener_atlas.go @@ -32,7 +32,8 @@ func atlasListenerFactory(config map[string]string, logger io.Writer) (net.Liste Version: version.GetVersion().VersionNumber(), ResourceType: "vault-cluster", Meta: map[string]string{ - "node_id": config["node_id"], + "node_id": config["node_id"], + "cluster_name": config["cluster_name"], }, Atlas: scada.AtlasConfig{ Endpoint: config["endpoint"],