Skip to content

Commit

Permalink
zrok agent console (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelquigley committed Oct 4, 2024
1 parent 6bcd569 commit b0178a0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions cmd/zrok/agentConsole.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main

import (
"github.com/openziti/zrok/tui"
"github.com/spf13/cobra"
)

func init() {
agentCmd.AddCommand(newAgentConsoleCommand().cmd)
}

type agentConsoleCommand struct {
cmd *cobra.Command
}

func newAgentConsoleCommand() *agentConsoleCommand {
cmd := &cobra.Command{
Use: "console",
Short: "Open the Agent console",
Args: cobra.NoArgs,
}
command := &agentConsoleCommand{cmd}
cmd.Run = command.run
return command
}

func (cmd *agentConsoleCommand) run(_ *cobra.Command, _ []string) {
if err := openBrowser("http://localhost:8888"); err != nil {
tui.Error("unable to open agent console at 'http://localhost:8888'", err)
}
}
2 changes: 1 addition & 1 deletion cmd/zrok/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func newConsoleCommand() *consoleCommand {
cmd := &cobra.Command{
Use: "console",
Short: "Open the web console",
Args: cobra.ExactArgs(0),
Args: cobra.NoArgs,
}
command := &consoleCommand{cmd}
cmd.Run = command.run
Expand Down

0 comments on commit b0178a0

Please sign in to comment.