-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlightsvr.go
More file actions
34 lines (29 loc) · 816 Bytes
/
lightsvr.go
File metadata and controls
34 lines (29 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"context"
"flag"
"fmt"
"gitee.com/unitedrhino/share/utils"
"github.com/zeromicro/go-zero/core/logx"
_ "github.com/zeromicro/go-zero/core/proc" //开启pprof采集 https://mp.weixin.qq.com/s/yYFM3YyBbOia3qah3eRVQA
"lightsvr/internal/config"
"lightsvr/internal/handler"
"lightsvr/internal/startup"
"lightsvr/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func main() {
defer utils.Recover(context.Background())
flag.Parse()
logx.DisableStat()
var c config.Config
utils.ConfMustLoad("etc/lightsvr.yaml", &c)
server := rest.MustNewServer(c.RestConf)
defer server.Stop()
ctx := svc.NewServiceContext(c)
handler.RegisterHandlers(server, ctx)
server.PrintRoutes()
startup.InitEventBus(ctx)
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
server.Start()
}