MCPcopy Create free account
hub / github.com/cloudwan/gohan / getGraceServerCommand

Function getGraceServerCommand

cli/cli.go:629–654  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

627func (o options) StatusFile() string { return o.OptStatusFile }
628
629func getGraceServerCommand() cli.Command {
630 return cli.Command{
631 Name: "glace-server",
632 ShortName: "gsrv",
633 Usage: "Run API Server with graceful restart support",
634 Description: "Run Gohan API server with graceful restart support",
635 Flags: []cli.Flag{
636 cli.StringFlag{Name: "config-file", Value: defaultConfigFile, Usage: "Server config File"},
637 },
638 Action: func(c *cli.Context) {
639 configFile := c.String("config-file")
640 loadConfig(configFile)
641 opts := &options{OptInterval: -1}
642 opts.OptCommand = os.Args[0]
643 config := util.GetConfig()
644 opts.OptPorts = []string{config.GetString("address", ":9091")}
645 opts.OptArgs = []string{"server", "--config-file", configFile}
646 s, err := starter.NewStarter(opts)
647 if err != nil {
648 fmt.Fprintf(os.Stderr, "error: %s\n", err)
649 return
650 }
651 s.Run()
652 },
653 }
654}

Callers 1

RunFunction · 0.85

Calls 4

loadConfigFunction · 0.85
GetStringMethod · 0.80
StringMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected