mirror of
https://github.com/openziti/zrok.git
synced 2024-12-23 15:18:52 +01:00
zrok agent console (#221)
This commit is contained in:
parent
6bcd5695ec
commit
b0178a0619
31
cmd/zrok/agentConsole.go
Normal file
31
cmd/zrok/agentConsole.go
Normal file
@ -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)
|
||||||
|
}
|
||||||
|
}
|
@ -19,7 +19,7 @@ func newConsoleCommand() *consoleCommand {
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "console",
|
Use: "console",
|
||||||
Short: "Open the web console",
|
Short: "Open the web console",
|
||||||
Args: cobra.ExactArgs(0),
|
Args: cobra.NoArgs,
|
||||||
}
|
}
|
||||||
command := &consoleCommand{cmd}
|
command := &consoleCommand{cmd}
|
||||||
cmd.Run = command.run
|
cmd.Run = command.run
|
||||||
|
Loading…
Reference in New Issue
Block a user