mirror of
https://github.com/openziti/zrok.git
synced 2024-11-25 09:33:43 +01:00
38 lines
960 B
Go
38 lines
960 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/michaelquigley/cf"
|
|
"github.com/openziti/zrok/endpoints/publicProxy"
|
|
"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 := publicProxy.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()))
|
|
}
|