forked from WeixinCloud/wxcloudrun-wxcomponent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (38 loc) · 916 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
44
package main
import (
"github.com/WeixinCloud/wxcloudrun-wxcomponent/comm/inits"
"github.com/WeixinCloud/wxcloudrun-wxcomponent/comm/log"
"github.com/WeixinCloud/wxcloudrun-wxcomponent/routers"
_ "github.com/joho/godotenv/autoload"
"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)
}
}