mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-18 18:32:30 +00:00
✨ Add flags to open
command
This commit is contained in:
parent
c25be876f2
commit
d174c574c6
14
cmd/open.go
14
cmd/open.go
@ -1,12 +1,15 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/creasty/defaults"
|
||||||
|
"github.com/kubeshark/kubeshark/config/configStructs"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
var openCmd = &cobra.Command{
|
var openCmd = &cobra.Command{
|
||||||
Use: "open",
|
Use: "open",
|
||||||
Short: "Open the web UI in the browser.",
|
Short: "Open the web UI (front-end) in the browser via proxy/port-forward.",
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
runOpen()
|
runOpen()
|
||||||
return nil
|
return nil
|
||||||
@ -15,4 +18,13 @@ var openCmd = &cobra.Command{
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(openCmd)
|
rootCmd.AddCommand(openCmd)
|
||||||
|
|
||||||
|
defaultTapConfig := configStructs.TapConfig{}
|
||||||
|
if err := defaults.Set(&defaultTapConfig); err != nil {
|
||||||
|
log.Debug().Err(err).Send()
|
||||||
|
}
|
||||||
|
|
||||||
|
openCmd.Flags().Uint16(configStructs.ProxyPortFrontLabel, defaultTapConfig.Front.SrcPort, "Provide a custom port for the front-end proxy/port-forward.")
|
||||||
|
openCmd.Flags().Uint16(configStructs.ProxyPortHubLabel, defaultTapConfig.Hub.SrcPort, "Provide a custom port for the Hub proxy/port-forward.")
|
||||||
|
openCmd.Flags().String(configStructs.ProxyHostLabel, defaultTapConfig.ProxyHost, "Provide a custom host for the proxy/port-forward.")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user