mirror of
https://github.com/openziti/zrok.git
synced 2025-06-18 15:56:42 +02:00
environment details (#124)
This commit is contained in:
parent
7f5321f416
commit
4bc25100b6
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/jedib0t/go-pretty/v6/table"
|
||||||
"github.com/openziti-test-kitchen/zrok/zrokdir"
|
"github.com/openziti-test-kitchen/zrok/zrokdir"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"os"
|
"os"
|
||||||
@ -30,10 +31,22 @@ func newStatusCommand() *statusCommand {
|
|||||||
func (cmd *statusCommand) run(_ *cobra.Command, _ []string) {
|
func (cmd *statusCommand) run(_ *cobra.Command, _ []string) {
|
||||||
_, _ = fmt.Fprintf(os.Stderr, "\n")
|
_, _ = fmt.Fprintf(os.Stderr, "\n")
|
||||||
|
|
||||||
_, err := zrokdir.LoadEnvironment()
|
env, err := zrokdir.LoadEnvironment()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_, _ = fmt.Fprintf(os.Stderr, "%v: Unable to load your local environment! (%v)\n\n", warningLabel, err)
|
_, _ = fmt.Fprintf(os.Stderr, "%v: Unable to load your local environment! (%v)\n\n", warningLabel, err)
|
||||||
_, _ = fmt.Fprintf(os.Stderr, "To create a local environment use the %v command.\n", codeStyle.Render("zrok enable"))
|
_, _ = fmt.Fprintf(os.Stderr, "To create a local environment use the %v command.\n", codeStyle.Render("zrok enable"))
|
||||||
|
} else {
|
||||||
|
_, _ = fmt.Fprintf(os.Stdout, codeStyle.Render("Environment"+":\n"))
|
||||||
|
_, _ = fmt.Fprintf(os.Stdout, "\n")
|
||||||
|
|
||||||
|
t := table.NewWriter()
|
||||||
|
t.SetOutputMirror(os.Stdout)
|
||||||
|
t.SetStyle(table.StyleColoredDark)
|
||||||
|
t.AppendHeader(table.Row{"Property", "Value"})
|
||||||
|
t.AppendRow(table.Row{"API Endpoint", env.ApiEndpoint})
|
||||||
|
t.AppendRow(table.Row{"Secret Token", env.Token})
|
||||||
|
t.AppendRow(table.Row{"Ziti Identity", env.ZId})
|
||||||
|
t.Render()
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _ = fmt.Fprintf(os.Stderr, "\n")
|
_, _ = fmt.Fprintf(os.Stderr, "\n")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user