add grpc server options

This commit is contained in:
c9s 2022-04-07 11:01:43 +08:00
parent 2b615d4933
commit 730f50c548
2 changed files with 11 additions and 2 deletions

View File

@ -28,8 +28,12 @@ func init() {
RunCmd.Flags().String("totp-account-name", "", "") RunCmd.Flags().String("totp-account-name", "", "")
RunCmd.Flags().Bool("enable-webserver", false, "enable webserver") RunCmd.Flags().Bool("enable-webserver", false, "enable webserver")
RunCmd.Flags().Bool("enable-web-server", false, "legacy option, this is renamed to --enable-webserver") RunCmd.Flags().Bool("enable-web-server", false, "legacy option, this is renamed to --enable-webserver")
RunCmd.Flags().String("cpu-profile", "", "cpu profile")
RunCmd.Flags().String("webserver-bind", ":8080", "webserver binding") RunCmd.Flags().String("webserver-bind", ":8080", "webserver binding")
RunCmd.Flags().Bool("enable-grpc", false, "enable grpc server")
RunCmd.Flags().String("grpc-bind", ":6688", "grpc server binding")
RunCmd.Flags().String("cpu-profile", "", "cpu profile")
RunCmd.Flags().Bool("setup", false, "use setup mode") RunCmd.Flags().Bool("setup", false, "use setup mode")
RootCmd.AddCommand(RunCmd) RootCmd.AddCommand(RunCmd)
} }
@ -40,7 +44,7 @@ var RunCmd = &cobra.Command{
// SilenceUsage is an option to silence usage when an error occurs. // SilenceUsage is an option to silence usage when an error occurs.
SilenceUsage: true, SilenceUsage: true,
RunE: run, RunE: run,
} }
func runSetup(baseCtx context.Context, userConfig *bbgo.Config, enableApiServer bool) error { func runSetup(baseCtx context.Context, userConfig *bbgo.Config, enableApiServer bool) error {

5
pkg/grpc/server.go Normal file
View File

@ -0,0 +1,5 @@
package grpc