gorush/router/server_lambda.go

26 lines
578 B
Go
Raw Normal View History

2021-07-13 18:16:09 +00:00
// +build lambda
package router
import (
"context"
"net/http"
"github.com/appleboy/gorush/config"
"github.com/appleboy/gorush/logx"
2021-07-13 18:16:09 +00:00
"github.com/apex/gateway"
)
// RunHTTPServer provide run http or https protocol.
func RunHTTPServer(ctx context.Context, cfg config.ConfYaml, s ...*http.Server) (err error) {
if !cfg.Core.Enabled {
logx.LogAccess.Debug("httpd server is disabled.")
2021-07-13 18:16:09 +00:00
return nil
}
logx.LogAccess.Info("HTTPD server is running on " + cfg.Core.Port + " port.")
2021-07-13 18:16:09 +00:00
return gateway.ListenAndServe(cfg.Core.Address+":"+cfg.Core.Port, routerEngine(cfg))
2021-07-13 18:16:09 +00:00
}