From 89a4930b1df2e583dc2f853f43b606022132ea32 Mon Sep 17 00:00:00 2001 From: Bram Vogelaar Date: Thu, 18 May 2023 17:23:12 +0200 Subject: [PATCH] agent: display node id on start up for servers (#17084) Signed-off-by: Bram Vogelaar --- .changelog/17084.txt | 3 +++ command/agent/command.go | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 .changelog/17084.txt diff --git a/.changelog/17084.txt b/.changelog/17084.txt new file mode 100644 index 000000000..f1a7aea22 --- /dev/null +++ b/.changelog/17084.txt @@ -0,0 +1,3 @@ +```release-note:improvement +agent: Display server node ID in agent configuration at startup +``` diff --git a/command/agent/command.go b/command/agent/command.go index 6d72dc79d..4a99a53fc 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -781,6 +781,12 @@ func (c *Command) Run(args []string) int { info["region"] = fmt.Sprintf("%s (DC: %s)", config.Region, config.Datacenter) info["bind addrs"] = c.getBindAddrSynopsis() info["advertise addrs"] = c.getAdvertiseAddrSynopsis() + if config.Server.Enabled { + serverConfig, err := c.agent.serverConfig() + if err == nil { + info["node id"] = serverConfig.NodeID + } + } // Sort the keys for output infoKeys := make([]string, 0, len(info))