MCPcopy
hub / github.com/hwholiday/learning_tools / main

Function main

micro_agent/main.go:21–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19var conf = flag.String("conf", "/home/ghost/go/src/micro_agent/conf", "conf path")
20
21func main() {
22 base.Init(*conf)
23 registry := etcdv3.NewRegistry(func(options *registry.Options) {
24 options.Timeout = time.Second * 5
25 options.Addrs = strings.Split(config.GetServerConfig().GetEtcdAddr(), ",")
26 })
27 service := micro.NewService(
28 micro.Name(config.GetServerConfig().GetServerName()),
29 micro.Version("latest"),
30 micro.Registry(registry),
31 micro.RegisterTTL(time.Second*30),
32 micro.RegisterInterval(time.Second*15),
33 )
34 service.Init(
35 micro.Action(func(c *cli.Context) {
36 model.Init()
37 handler.Init()
38 }),
39 )
40 // 注册服务
41 tool.GetLogger().Info("start service " + config.GetServerConfig().GetServerName() + " success")
42 _ = user_agent.RegisterUserHandler(service.Server(), handler.GetService())
43 // 启动服务
44 if err := service.Run(); err != nil {
45 panic(err)
46 }
47}

Callers

nothing calls this directly

Calls 5

InitMethod · 0.65
GetEtcdAddrMethod · 0.65
NameMethod · 0.65
GetServerNameMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected