5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-09 23:40:27 +00:00

Disable echo banner and output (api)

This commit is contained in:
Wim 2018-02-21 00:49:10 +01:00
parent 55ab0c12f1
commit 5f3b6ec007

View File

@ -3,9 +3,9 @@ package api
import ( import (
"encoding/json" "encoding/json"
"github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/bridge/config"
log "github.com/sirupsen/logrus"
"github.com/labstack/echo" "github.com/labstack/echo"
"github.com/labstack/echo/middleware" "github.com/labstack/echo/middleware"
log "github.com/sirupsen/logrus"
"github.com/zfjagann/golang-ring" "github.com/zfjagann/golang-ring"
"net/http" "net/http"
"sync" "sync"
@ -36,6 +36,8 @@ func init() {
func New(cfg *config.BridgeConfig) *Api { func New(cfg *config.BridgeConfig) *Api {
b := &Api{BridgeConfig: cfg} b := &Api{BridgeConfig: cfg}
e := echo.New() e := echo.New()
e.HideBanner = true
e.HidePort = true
b.Messages = ring.Ring{} b.Messages = ring.Ring{}
b.Messages.SetCapacity(b.Config.Buffer) b.Messages.SetCapacity(b.Config.Buffer)
if b.Config.Token != "" { if b.Config.Token != "" {
@ -47,6 +49,10 @@ func New(cfg *config.BridgeConfig) *Api {
e.GET("/api/stream", b.handleStream) e.GET("/api/stream", b.handleStream)
e.POST("/api/message", b.handlePostMessage) e.POST("/api/message", b.handlePostMessage)
go func() { go func() {
if b.Config.BindAddress == "" {
flog.Fatalf("No BindAddress configured.")
}
flog.Infof("Listening on %s", b.Config.BindAddress)
flog.Fatal(e.Start(b.Config.BindAddress)) flog.Fatal(e.Start(b.Config.BindAddress))
}() }()
return b return b