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,
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2021-06-14 07:18:29 +00:00
|
|
|
// serverCmd.Flags().IntVarP(&config.GocConfig.Port, "port", "", 7777, "listen port to start a coverage host center")
|
|
|
|
// serverCmd.Flags().StringVarP(&config.GocConfig.StorePath, "storepath", "", "goc.store", "the file to save all goc server information")
|
2021-06-10 12:03:47 +00:00
|
|
|
|
|
|
|
rootCmd.AddCommand(serverCmd)
|
|
|
|
}
|
|
|
|
|
|
|
|
func serve(cmd *cobra.Command, args []string) {
|
2021-06-17 11:53:00 +00:00
|
|
|
server.RunGocServerUntilExit(8080)
|
2021-06-10 12:03:47 +00:00
|
|
|
}
|