mirror of
https://github.com/openziti/zrok.git
synced 2024-12-26 08:38:50 +01:00
Merge
This commit is contained in:
parent
38190f45e3
commit
ef9c88ac44
@ -2,6 +2,13 @@
|
||||
|
||||
CHANGE: Fix for `zrok enable` error path handling (https://github.com/openziti/zrok/issues/244)
|
||||
|
||||
FEATURE: `zrok controller validate` and `zrok access public validate` will both perform a quick syntax validation on controller and public frontend configuration documents (https://github.com/openziti/zrok/issues/238)
|
||||
|
||||
$ zrok controller validate etc/dev.yml
|
||||
[ERROR]: controller config validation failed (error loading controller config 'etc/dev.yml': field 'maintenance': field 'registration': field 'expiration_timeout': got [bool], expected [time.Duration])
|
||||
|
||||
CHANGE: `zrok status` no longer shows secrets (secret token, ziti identity) unless the `--secrets` flag is passed (https://github.com/openziti/zrok/issues/243)
|
||||
|
||||
# v0.3.1
|
||||
|
||||
CHANGE: Incorporate initial docker image build (https://github.com/openziti/zrok/issues/217)
|
||||
@ -78,7 +85,7 @@ FIX: Fixed PostgreSQL migration issue where sequences got reset and resulted in
|
||||
|
||||
FIX: Remove `frontend` instances when `zrok disable`-ing an environment containing them (https://github.com/openziti/zrok/issues/171)
|
||||
|
||||
# v0.3.0
|
||||
# v0.3.x Series
|
||||
|
||||
The `v0.2` series was a _proof-of-concept_ implementation for the overall `zrok` architecture and the concept.
|
||||
|
||||
|
@ -9,8 +9,11 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var accessPublicCmd *accessPublicCommand
|
||||
|
||||
func init() {
|
||||
accessCmd.AddCommand(newAccessPublicCommand().cmd)
|
||||
accessPublicCmd = newAccessPublicCommand()
|
||||
accessCmd.AddCommand(accessPublicCmd.cmd)
|
||||
}
|
||||
|
||||
type accessPublicCommand struct {
|
||||
@ -29,7 +32,7 @@ func newAccessPublicCommand() *accessPublicCommand {
|
||||
return command
|
||||
}
|
||||
|
||||
func (self *accessPublicCommand) run(_ *cobra.Command, args []string) {
|
||||
func (cmd *accessPublicCommand) run(_ *cobra.Command, args []string) {
|
||||
cfg := publicFrontend.DefaultConfig()
|
||||
if len(args) == 1 {
|
||||
if err := cfg.Load(args[0]); err != nil {
|
||||
|
37
cmd/zrok/accessPublicValidate.go
Normal file
37
cmd/zrok/accessPublicValidate.go
Normal file
@ -0,0 +1,37 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/michaelquigley/cf"
|
||||
"github.com/openziti/zrok/endpoints/publicFrontend"
|
||||
"github.com/openziti/zrok/tui"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
accessPublicCmd.cmd.AddCommand(newAccessPublicValidateCommand().cmd)
|
||||
}
|
||||
|
||||
type accessPublicValidateCommand struct {
|
||||
cmd *cobra.Command
|
||||
}
|
||||
|
||||
func newAccessPublicValidateCommand() *accessPublicValidateCommand {
|
||||
cmd := &cobra.Command{
|
||||
Use: "validate <configPath>",
|
||||
Short: "Validate a zrok access public configuration document",
|
||||
Args: cobra.ExactArgs(1),
|
||||
}
|
||||
command := &accessPublicValidateCommand{cmd: cmd}
|
||||
cmd.Run = command.run
|
||||
return command
|
||||
}
|
||||
|
||||
func (cmd *accessPublicValidateCommand) run(_ *cobra.Command, args []string) {
|
||||
cfg := publicFrontend.DefaultConfig()
|
||||
if err := cfg.Load(args[0]); err != nil {
|
||||
tui.Error(fmt.Sprintf("unable to load configuration '%v'", args[0]), err)
|
||||
}
|
||||
logrus.Infof(cf.Dump(cfg, cf.DefaultOptions()))
|
||||
}
|
@ -7,8 +7,11 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var controllerCmd *controllerCommand
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(newControllerCommand().cmd)
|
||||
controllerCmd = newControllerCommand()
|
||||
rootCmd.AddCommand(controllerCmd.cmd)
|
||||
}
|
||||
|
||||
type controllerCommand struct {
|
||||
|
36
cmd/zrok/controllerValidate.go
Normal file
36
cmd/zrok/controllerValidate.go
Normal file
@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/michaelquigley/cf"
|
||||
"github.com/openziti/zrok/controller"
|
||||
"github.com/openziti/zrok/tui"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
controllerCmd.cmd.AddCommand(newControllerValidateCommand().cmd)
|
||||
}
|
||||
|
||||
type controllerValidateCommand struct {
|
||||
cmd *cobra.Command
|
||||
}
|
||||
|
||||
func newControllerValidateCommand() *controllerValidateCommand {
|
||||
cmd := &cobra.Command{
|
||||
Use: "validate <configPath>",
|
||||
Short: "Validate a zrok controller configuration document",
|
||||
Args: cobra.ExactArgs(1),
|
||||
}
|
||||
command := &controllerValidateCommand{cmd: cmd}
|
||||
cmd.Run = command.run
|
||||
return command
|
||||
}
|
||||
|
||||
func (cmd *controllerValidateCommand) run(_ *cobra.Command, args []string) {
|
||||
cfg, err := controller.LoadConfig(args[0])
|
||||
if err != nil {
|
||||
tui.Error("controller config validation failed", err)
|
||||
}
|
||||
logrus.Infof(cf.Dump(cfg, cf.DefaultOptions()))
|
||||
}
|
@ -14,7 +14,8 @@ func init() {
|
||||
}
|
||||
|
||||
type statusCommand struct {
|
||||
cmd *cobra.Command
|
||||
secrets bool
|
||||
cmd *cobra.Command
|
||||
}
|
||||
|
||||
func newStatusCommand() *statusCommand {
|
||||
@ -25,6 +26,7 @@ func newStatusCommand() *statusCommand {
|
||||
Args: cobra.ExactArgs(0),
|
||||
}
|
||||
command := &statusCommand{cmd: cmd}
|
||||
cmd.Flags().BoolVar(&command.secrets, "secrets", false, "Show secrets in status output")
|
||||
cmd.Run = command.run
|
||||
return command
|
||||
}
|
||||
@ -57,8 +59,22 @@ func (cmd *statusCommand) run(_ *cobra.Command, _ []string) {
|
||||
t.SetOutputMirror(os.Stdout)
|
||||
t.SetStyle(table.StyleColoredDark)
|
||||
t.AppendHeader(table.Row{"Property", "Value"})
|
||||
t.AppendRow(table.Row{"Secret Token", zrd.Env.Token})
|
||||
t.AppendRow(table.Row{"Ziti Identity", zrd.Env.ZId})
|
||||
if cmd.secrets {
|
||||
t.AppendRow(table.Row{"Secret Token", zrd.Env.Token})
|
||||
t.AppendRow(table.Row{"Ziti Identity", zrd.Env.ZId})
|
||||
} else {
|
||||
secretToken := "<<SET>>"
|
||||
if zrd.Env.Token == "" {
|
||||
secretToken = "<<UNSET>>"
|
||||
}
|
||||
t.AppendRow(table.Row{"Secret Token", secretToken})
|
||||
|
||||
zId := "<<SET>>"
|
||||
if zrd.Env.ZId == "" {
|
||||
zId = "<<UNSET>>"
|
||||
}
|
||||
t.AppendRow(table.Row{"Ziti Identity", zId})
|
||||
}
|
||||
t.Render()
|
||||
}
|
||||
_, _ = fmt.Fprintf(os.Stdout, "\n")
|
||||
|
Loading…
Reference in New Issue
Block a user