-
Notifications
You must be signed in to change notification settings - Fork 169
/
main.go
43 lines (37 loc) · 877 Bytes
/
main.go
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
35
36
37
38
39
40
41
42
43
package main
import (
"github.com/WeixinCloud/wxcloudrun-wxcomponent/comm/inits"
"github.com/WeixinCloud/wxcloudrun-wxcomponent/comm/log"
"github.com/WeixinCloud/wxcloudrun-wxcomponent/routers"
"golang.org/x/sync/errgroup"
)
func main() {
log.Infof("system begin")
if err := inits.Init(); err != nil {
log.Errorf("inits failed, err:%v", err)
return
}
log.Infof("inits.Init Succ")
var g errgroup.Group
// 内部服务
g.Go(func() error {
r := routers.InnerServiceInit()
if err := r.Run("127.0.0.1:8081"); err != nil {
log.Error("startup inner service failed, err:%v", err)
return err
}
return nil
})
// 外部服务
g.Go(func() error {
r := routers.Init()
if err := r.Run(":80"); err != nil {
log.Error("startup service failed, err:%v", err)
return err
}
return nil
})
if err := g.Wait(); err != nil {
log.Error(err)
}
}