From a41accd033a8d7e859a4bff89ae64e1f3500e4d2 Mon Sep 17 00:00:00 2001 From: Qais Patankar Date: Wed, 24 Jun 2020 23:25:10 +0100 Subject: Add sane RemoteNickFormat default for API (#1157) --- bridge/api/api.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'bridge/api') diff --git a/bridge/api/api.go b/bridge/api/api.go index 9a3f1178..38d1a4bd 100644 --- a/bridge/api/api.go +++ b/bridge/api/api.go @@ -10,7 +10,7 @@ import ( "github.com/42wim/matterbridge/bridge/config" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" - "github.com/zfjagann/golang-ring" + ring "github.com/zfjagann/golang-ring" ) type API struct { @@ -41,6 +41,13 @@ func New(cfg *bridge.Config) bridge.Bridger { return key == b.GetString("Token"), nil })) } + + // Set RemoteNickFormat to a sane default + if !b.IsKeySet("RemoteNickFormat") { + b.Log.Debugln("RemoteNickFormat is unset, defaulting to \"{NICK}\"") + b.Config.Config.Viper().Set(b.GetConfigKey("RemoteNickFormat"), "{NICK}") + } + e.GET("/api/health", b.handleHealthcheck) e.GET("/api/messages", b.handleMessages) e.GET("/api/stream", b.handleStream) -- cgit v1.2.3