debug needed

This commit is contained in:
TonyChyi
2022-09-26 16:07:25 +08:00
parent bd0812cc42
commit 821c0cffb8
12 changed files with 148 additions and 171 deletions

View File

@@ -1,7 +0,0 @@
package webserver
import "github.com/sirupsen/logrus"
func init() {
logrus.Info("web server loaded")
}

View File

@@ -12,15 +12,18 @@ type Server struct {
rtcConnector *webrtcconnection.Connection
}
var DefaultServer *Server
func NewServer(o *Options) (*Server, error) {
rtc, err := webrtcconnection.New(o.WebRTC)
if err != nil {
return nil, err
}
func NewServer(o *Options) *Server {
s := &Server{
options: o,
webServer: gin.New(),
rtcConnector: webrtcconnection.New(o.WebRTC),
rtcConnector: rtc,
}
return s
return s, nil
}
func (s *Server) Run() error {
@@ -29,12 +32,3 @@ func (s *Server) Run() error {
s.setupRoute()
return s.webServer.Run(s.options.Listen)
}
func Setup(o *Options) {
DefaultServer = NewServer(o)
go func() {
if err := DefaultServer.Run(); err != nil {
logrus.Fatal("cannot run webserver with error: ", err)
}
}()
}

View File

@@ -26,8 +26,6 @@ func staticFileHandler() gin.HandlerFunc {
defer ctx.Abort()
filename := strings.TrimLeft(ctx.Request.RequestURI, "/")
logrus.Debug("static file: ", filename)
if filename == "" {
filename = "index.html"
}