goc/cmd/server.go

29 lines
541 B
Go
Raw Normal View History

2021-06-10 12:03:47 +00:00
package cmd
import (
2021-06-17 11:53:00 +00:00
"github.com/qiniu/goc/v2/pkg/server"
2021-06-10 12:03:47 +00:00
"github.com/spf13/cobra"
)
var serverCmd = &cobra.Command{
Use: "server",
Short: "start a service registry center",
Long: "start a service registry center",
Example: "",
Run: serve,
}
var (
serverHost string
)
2021-06-10 12:03:47 +00:00
func init() {
serverCmd.Flags().StringVarP(&serverHost, "host", "", "127.0.0.1:7777", "specify the host of the goc server")
2021-06-10 12:03:47 +00:00
rootCmd.AddCommand(serverCmd)
}
func serve(cmd *cobra.Command, args []string) {
server.RunGocServerUntilExit(serverHost)
2021-06-10 12:03:47 +00:00
}