-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (26 loc) · 729 Bytes
/
main.go
File metadata and controls
34 lines (26 loc) · 729 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 (
"github.com/ClubWeGo/commentmicro/dal"
comment "github.com/ClubWeGo/commentmicro/kitex_gen/comment/commentservice"
"github.com/cloudwego/kitex/pkg/rpcinfo"
"github.com/cloudwego/kitex/server"
etcd "github.com/kitex-contrib/registry-etcd"
"log"
"net"
)
func main() {
dal.Init()
r, err := etcd.NewEtcdRegistry([]string{"0.0.0.0:2379"})
if err != nil {
log.Fatal(err)
}
addr, _ := net.ResolveTCPAddr("tcp", "0.0.0.0:10010")
svr := comment.NewServer(new(CommentServiceImpl),
server.WithServerBasicInfo(&rpcinfo.EndpointBasicInfo{ServiceName: "commentservice"}),
server.WithRegistry(r),
server.WithServiceAddr(addr))
err = svr.Run()
if err != nil {
log.Println(err.Error())
}
}