mirror of
https://github.com/openziti/zrok.git
synced 2024-12-22 23:02:52 +01:00
parent
7630460c85
commit
4ec0004285
@ -1,6 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import "github.com/spf13/cobra"
|
import (
|
||||||
|
"github.com/openziti-test-kitchen/zrok/zrokdir"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
type accessPrivateCommand struct {
|
type accessPrivateCommand struct {
|
||||||
cmd *cobra.Command
|
cmd *cobra.Command
|
||||||
@ -18,4 +21,31 @@ func newAccessPrivateCommand() *accessPrivateCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cmd *accessPrivateCommand) run(_ *cobra.Command, args []string) {
|
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")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user