Files
zrok/cmd/zrok2/adminBootstrap.go
2026-01-29 16:41:35 -05:00

44 lines
1.0 KiB
Go

package main
import (
"github.com/michaelquigley/df/dd"
"github.com/michaelquigley/df/dl"
"github.com/openziti/zrok/v2/controller"
"github.com/openziti/zrok/v2/controller/config"
"github.com/spf13/cobra"
)
func init() {
adminCmd.AddCommand(newAdminBootstrap().cmd)
}
type adminBootstrap struct {
cmd *cobra.Command
skipFrontend bool
}
func newAdminBootstrap() *adminBootstrap {
cmd := &cobra.Command{
Use: "bootstrap <configPath>",
Short: "Bootstrap the underlying Ziti network for zrok",
Args: cobra.ExactArgs(1),
}
command := &adminBootstrap{cmd: cmd}
cmd.Run = command.run
cmd.Flags().BoolVar(&command.skipFrontend, "skip-frontend", false, "Skip frontend identity bootstrapping")
return command
}
func (cmd *adminBootstrap) run(_ *cobra.Command, args []string) {
configPath := args[0]
inCfg, err := config.LoadConfig(configPath)
if err != nil {
panic(err)
}
dl.Info(dd.MustInspect(inCfg))
if err := controller.Bootstrap(cmd.skipFrontend, inCfg); err != nil {
panic(err)
}
dl.Info("bootstrap complete!")
}