mirror of
https://github.com/openziti/zrok.git
synced 2025-03-14 23:48:22 +01:00
environment details (#124)
This commit is contained in:
parent
7f5321f416
commit
4bc25100b6
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/jedib0t/go-pretty/v6/table"
|
||||
"github.com/openziti-test-kitchen/zrok/zrokdir"
|
||||
"github.com/spf13/cobra"
|
||||
"os"
|
||||
@ -30,10 +31,22 @@ func newStatusCommand() *statusCommand {
|
||||
func (cmd *statusCommand) run(_ *cobra.Command, _ []string) {
|
||||
_, _ = fmt.Fprintf(os.Stderr, "\n")
|
||||
|
||||
_, err := zrokdir.LoadEnvironment()
|
||||
env, err := zrokdir.LoadEnvironment()
|
||||
if err != nil {
|
||||
_, _ = 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"))
|
||||
} 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")
|
||||
|
Loading…
Reference in New Issue
Block a user