-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.go
35 lines (31 loc) · 857 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
package main
import (
"net"
"os"
"github.com/getgauge-contrib/json-report/logger"
"github.com/getgauge/gauge-proto/go/gauge_messages"
"google.golang.org/grpc"
)
const oneGB = 1024 * 1024 * 1024
func main() {
findProjectRoot()
action := os.Getenv(pluginActionEnv)
if action == setupAction {
addDefaultPropertiesToProject()
} else if action == executionAction {
os.Chdir(projectRoot)
address, err := net.ResolveTCPAddr("tcp", "127.0.0.1:0")
if err != nil {
logger.Fatal("failed to start server")
}
l, err := net.ListenTCP("tcp", address)
if err != nil {
logger.Fatal("failed to start server")
}
server := grpc.NewServer(grpc.MaxRecvMsgSize(oneGB))
h := &handler{server: server}
gauge_messages.RegisterReporterServer(server, h)
logger.Info("Listening on port:%d", l.Addr().(*net.TCPAddr).Port)
server.Serve(l)
}
}