summaryrefslogtreecommitdiffstats
path: root/bridge/api
diff options
context:
space:
mode:
authorQais Patankar <qaisjp@gmail.com>2020-06-24 23:25:10 +0100
committerGitHub <noreply@github.com>2020-06-25 00:25:10 +0200
commita41accd033a8d7e859a4bff89ae64e1f3500e4d2 (patch)
treee7b86f05c725632b2e285ac1ee42f669819dfc32 /bridge/api
parent37f7caf7f398bfab7acffe3e0dda443ed2ca041d (diff)
downloadmatterbridge-msglm-a41accd033a8d7e859a4bff89ae64e1f3500e4d2.tar.gz
matterbridge-msglm-a41accd033a8d7e859a4bff89ae64e1f3500e4d2.tar.bz2
matterbridge-msglm-a41accd033a8d7e859a4bff89ae64e1f3500e4d2.zip
Add sane RemoteNickFormat default for API (#1157)
Diffstat (limited to 'bridge/api')
-rw-r--r--bridge/api/api.go9
1 files changed, 8 insertions, 1 deletions
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)