more access private scaffolding (#106, #109)

This commit is contained in:
Michael Quigley 2022-11-23 12:04:07 -05:00
parent 7630460c85
commit 4ec0004285
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62

View File

@ -1,6 +1,9 @@
package main
import "github.com/spf13/cobra"
import (
"github.com/openziti-test-kitchen/zrok/zrokdir"
"github.com/spf13/cobra"
)
type accessPrivateCommand struct {
cmd *cobra.Command
@ -18,4 +21,31 @@ func newAccessPrivateCommand() *accessPrivateCommand {
}
func (cmd *accessPrivateCommand) run(_ *cobra.Command, args []string) {
env, err := zrokdir.LoadEnvironment()
if err != nil {
if !panicInstead {
showError("unable to load environment; did you 'zrok enable'?", err)
}
panic(err)
}
zif, err := zrokdir.ZitiIdentityFile("backend")
if err != nil {
if !panicInstead {
showError("unable to load ziti identity configuration", err)
}
panic(err)
}
if zif == "" {
panic("never")
}
zrok, err := zrokdir.ZrokClient(env.ApiEndpoint)
if err != nil {
if !panicInstead {
showError("unable to create zrok client", err)
}
panic(err)
}
if zrok == nil {
panic("never")
}
}