Create & Init Project...
This commit is contained in:
44
app/interface/live/web-room/cmd/BUILD
Normal file
44
app/interface/live/web-room/cmd/BUILD
Normal file
@ -0,0 +1,44 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_binary",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name = "cmd",
|
||||
embed = [":go_default_library"],
|
||||
tags = ["automanaged"],
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["main.go"],
|
||||
data = ["test.toml"],
|
||||
importpath = "go-common/app/interface/live/web-room/cmd",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//app/interface/live/web-room/conf:go_default_library",
|
||||
"//app/interface/live/web-room/server/http:go_default_library",
|
||||
"//app/interface/live/web-room/service:go_default_library",
|
||||
"//library/ecode/tip:go_default_library",
|
||||
"//library/log:go_default_library",
|
||||
"//library/net/trace:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
47
app/interface/live/web-room/cmd/main.go
Normal file
47
app/interface/live/web-room/cmd/main.go
Normal file
@ -0,0 +1,47 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"go-common/app/interface/live/web-room/conf"
|
||||
"go-common/app/interface/live/web-room/server/http"
|
||||
"go-common/app/interface/live/web-room/service"
|
||||
ecode "go-common/library/ecode/tip"
|
||||
"go-common/library/log"
|
||||
"go-common/library/net/trace"
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if err := conf.Init(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
log.Init(conf.Conf.Log)
|
||||
defer log.Close()
|
||||
log.Info("web-room-interface start")
|
||||
trace.Init(conf.Conf.Tracer)
|
||||
defer trace.Close()
|
||||
ecode.Init(conf.Conf.Ecode)
|
||||
svc := service.New(conf.Conf)
|
||||
http.Init(conf.Conf)
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
|
||||
for {
|
||||
s := <-c
|
||||
log.Info("get a signal %s", s.String())
|
||||
switch s {
|
||||
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
|
||||
svc.Close()
|
||||
log.Info("web-room-interface exit")
|
||||
time.Sleep(time.Second)
|
||||
return
|
||||
case syscall.SIGHUP:
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
21
app/interface/live/web-room/cmd/test.toml
Normal file
21
app/interface/live/web-room/cmd/test.toml
Normal file
@ -0,0 +1,21 @@
|
||||
[log]
|
||||
# dir = "/data/log/web-room"
|
||||
stdout = true
|
||||
# family = "live.live.web-room"
|
||||
# [log.agent]
|
||||
# taskID = "000161"
|
||||
# proto = "unixgram"
|
||||
# addr = "/var/run/lancer/collector.sock"
|
||||
# chan = 10240
|
||||
|
||||
[DMsend]
|
||||
taskID = "582"
|
||||
proto = "tcp"
|
||||
addr = "172.18.33.125:15140"
|
||||
chanSize = 10240
|
||||
|
||||
[DMerr]
|
||||
taskID = "1409"
|
||||
proto = "tcp"
|
||||
addr = "172.18.33.125:15140"
|
||||
chanSize = 10240
|
Reference in New Issue
Block a user