mirror of
https://github.com/openziti/zrok.git
synced 2025-06-21 18:21:34 +02:00
environment -> env_v0_3 (#369)
This commit is contained in:
parent
e26ef1ba1a
commit
c468c7ace9
@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/openziti/zrok/endpoints/proxy"
|
"github.com/openziti/zrok/endpoints/proxy"
|
||||||
"github.com/openziti/zrok/endpoints/tcpTunnel"
|
"github.com/openziti/zrok/endpoints/tcpTunnel"
|
||||||
"github.com/openziti/zrok/endpoints/udpTunnel"
|
"github.com/openziti/zrok/endpoints/udpTunnel"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/rest_client_zrok"
|
"github.com/openziti/zrok/rest_client_zrok"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/share"
|
"github.com/openziti/zrok/rest_client_zrok/share"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
"github.com/openziti/zrok/rest_model_zrok"
|
||||||
@ -48,7 +48,7 @@ func newAccessPrivateCommand() *accessPrivateCommand {
|
|||||||
func (cmd *accessPrivateCommand) run(_ *cobra.Command, args []string) {
|
func (cmd *accessPrivateCommand) run(_ *cobra.Command, args []string) {
|
||||||
shrToken := args[0]
|
shrToken := args[0]
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tui.Error("error loading environment", err)
|
tui.Error("error loading environment", err)
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/openziti/zrok/environment"
|
|
||||||
"github.com/openziti/zrok/rest_client_zrok/admin"
|
"github.com/openziti/zrok/rest_client_zrok/admin"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
"github.com/openziti/zrok/rest_model_zrok"
|
||||||
"github.com/openziti/zrok/tui"
|
"github.com/openziti/zrok/tui"
|
||||||
@ -35,7 +35,7 @@ func (cmd *adminCreateFrontendCommand) run(_ *cobra.Command, args []string) {
|
|||||||
publicName := args[1]
|
publicName := args[1]
|
||||||
urlTemplate := args[2]
|
urlTemplate := args[2]
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/admin"
|
"github.com/openziti/zrok/rest_client_zrok/admin"
|
||||||
"github.com/openziti/zrok/environment"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"os"
|
"os"
|
||||||
@ -32,7 +32,7 @@ func newAdminCreateIdentity() *adminCreateIdentity {
|
|||||||
func (cmd *adminCreateIdentity) run(_ *cobra.Command, args []string) {
|
func (cmd *adminCreateIdentity) run(_ *cobra.Command, args []string) {
|
||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
zif, err := environment.ZitiIdentityFile(name)
|
zif, err := env_v0_3.ZitiIdentityFile(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -41,7 +41,7 @@ func (cmd *adminCreateIdentity) run(_ *cobra.Command, args []string) {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ func (cmd *adminCreateIdentity) run(_ *cobra.Command, args []string) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := environment.SaveZitiIdentity(name, resp.Payload.Cfg); err != nil {
|
if err := env_v0_3.SaveZitiIdentity(name, resp.Payload.Cfg); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/admin"
|
"github.com/openziti/zrok/rest_client_zrok/admin"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
"github.com/openziti/zrok/rest_model_zrok"
|
||||||
"github.com/openziti/zrok/environment"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
@ -30,7 +30,7 @@ func newAdminDeleteFrontendCommand() *adminDeleteFrontendCommand {
|
|||||||
func (cmd *adminDeleteFrontendCommand) run(_ *cobra.Command, args []string) {
|
func (cmd *adminDeleteFrontendCommand) run(_ *cobra.Command, args []string) {
|
||||||
feToken := args[0]
|
feToken := args[0]
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/jaevor/go-nanoid"
|
"github.com/jaevor/go-nanoid"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/admin"
|
"github.com/openziti/zrok/rest_client_zrok/admin"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
"github.com/openziti/zrok/rest_model_zrok"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -43,7 +43,7 @@ func (cmd *adminGenerateCommand) run(_ *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error("error loading environment", err)
|
logrus.Error("error loading environment", err)
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/jedib0t/go-pretty/v6/table"
|
"github.com/jedib0t/go-pretty/v6/table"
|
||||||
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/admin"
|
"github.com/openziti/zrok/rest_client_zrok/admin"
|
||||||
"github.com/openziti/zrok/environment"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
@ -31,7 +31,7 @@ func newAdminListFrontendsCommand() *adminListFrontendsCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cmd *adminListFrontendsCommand) run(_ *cobra.Command, _ []string) {
|
func (cmd *adminListFrontendsCommand) run(_ *cobra.Command, _ []string) {
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/admin"
|
"github.com/openziti/zrok/rest_client_zrok/admin"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
"github.com/openziti/zrok/rest_model_zrok"
|
||||||
"github.com/openziti/zrok/environment"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
@ -38,7 +38,7 @@ func (cmd *adminUpdateFrontendCommand) run(_ *cobra.Command, args []string) {
|
|||||||
panic("must specify at least one of public name or url template")
|
panic("must specify at least one of public name or url template")
|
||||||
}
|
}
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ func newConfigGetCommand() *configGetCommand {
|
|||||||
func (cmd *configGetCommand) run(_ *cobra.Command, args []string) {
|
func (cmd *configGetCommand) run(_ *cobra.Command, args []string) {
|
||||||
configName := args[0]
|
configName := args[0]
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/openziti/zrok/environment"
|
|
||||||
"github.com/openziti/zrok/tui"
|
"github.com/openziti/zrok/tui"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
@ -33,7 +33,7 @@ func (cmd *configSetCommand) run(_ *cobra.Command, args []string) {
|
|||||||
configName := args[0]
|
configName := args[0]
|
||||||
value := args[1]
|
value := args[1]
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ func (cmd *configSetCommand) run(_ *cobra.Command, args []string) {
|
|||||||
switch configName {
|
switch configName {
|
||||||
case "apiEndpoint":
|
case "apiEndpoint":
|
||||||
if zrd.Cfg == nil {
|
if zrd.Cfg == nil {
|
||||||
zrd.Cfg = &environment.Config{}
|
zrd.Cfg = &env_v0_3.Config{}
|
||||||
}
|
}
|
||||||
ok, err := isFullyValidUrl(value)
|
ok, err := isFullyValidUrl(value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -2,8 +2,8 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/tui"
|
"github.com/openziti/zrok/tui"
|
||||||
"github.com/openziti/zrok/environment"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
@ -30,7 +30,7 @@ func newConfigUnsetCommand() *configUnsetCommand {
|
|||||||
func (cmd *configUnsetCommand) run(_ *cobra.Command, args []string) {
|
func (cmd *configUnsetCommand) run(_ *cobra.Command, args []string) {
|
||||||
configName := args[0]
|
configName := args[0]
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/tui"
|
"github.com/openziti/zrok/tui"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
@ -27,7 +27,7 @@ func newConsoleCommand() *consoleCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cmd *consoleCommand) run(_ *cobra.Command, _ []string) {
|
func (cmd *consoleCommand) run(_ *cobra.Command, _ []string) {
|
||||||
env, err := environment.Load()
|
env, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tui.Error("unable to load environment", err)
|
tui.Error("unable to load environment", err)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
httpTransport "github.com/go-openapi/runtime/client"
|
httpTransport "github.com/go-openapi/runtime/client"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
restEnvironment "github.com/openziti/zrok/rest_client_zrok/environment"
|
restEnvironment "github.com/openziti/zrok/rest_client_zrok/environment"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
"github.com/openziti/zrok/rest_model_zrok"
|
||||||
"github.com/openziti/zrok/tui"
|
"github.com/openziti/zrok/tui"
|
||||||
@ -31,7 +31,7 @@ func newDisableCommand() *disableCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cmd *disableCommand) run(_ *cobra.Command, _ []string) {
|
func (cmd *disableCommand) run(_ *cobra.Command, _ []string) {
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !panicInstead {
|
if !panicInstead {
|
||||||
tui.Error("unable to load environment", err)
|
tui.Error("unable to load environment", err)
|
||||||
@ -59,13 +59,13 @@ func (cmd *disableCommand) run(_ *cobra.Command, _ []string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Warnf("share cleanup failed (%v); will clean up local environment", err)
|
logrus.Warnf("share cleanup failed (%v); will clean up local environment", err)
|
||||||
}
|
}
|
||||||
if err := environment.DeleteEnvironment(); err != nil {
|
if err := env_v0_3.DeleteEnvironment(); err != nil {
|
||||||
if !panicInstead {
|
if !panicInstead {
|
||||||
tui.Error("error removing zrok environment", err)
|
tui.Error("error removing zrok environment", err)
|
||||||
}
|
}
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if err := environment.DeleteZitiIdentity("backend"); err != nil {
|
if err := env_v0_3.DeleteZitiIdentity("backend"); err != nil {
|
||||||
if !panicInstead {
|
if !panicInstead {
|
||||||
tui.Error("error removing zrok backend identity", err)
|
tui.Error("error removing zrok backend identity", err)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"os"
|
"os"
|
||||||
user2 "os/user"
|
user2 "os/user"
|
||||||
@ -10,7 +11,6 @@ import (
|
|||||||
"github.com/charmbracelet/bubbles/spinner"
|
"github.com/charmbracelet/bubbles/spinner"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
httptransport "github.com/go-openapi/runtime/client"
|
httptransport "github.com/go-openapi/runtime/client"
|
||||||
"github.com/openziti/zrok/environment"
|
|
||||||
restEnvironment "github.com/openziti/zrok/rest_client_zrok/environment"
|
restEnvironment "github.com/openziti/zrok/rest_client_zrok/environment"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
"github.com/openziti/zrok/rest_model_zrok"
|
||||||
"github.com/openziti/zrok/tui"
|
"github.com/openziti/zrok/tui"
|
||||||
@ -42,7 +42,7 @@ func newEnableCommand() *enableCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cmd *enableCommand) run(_ *cobra.Command, args []string) {
|
func (cmd *enableCommand) run(_ *cobra.Command, args []string) {
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ func (cmd *enableCommand) run(_ *cobra.Command, args []string) {
|
|||||||
prg.Send("writing the environment details...")
|
prg.Send("writing the environment details...")
|
||||||
}
|
}
|
||||||
apiEndpoint, _ := zrd.ApiEndpoint()
|
apiEndpoint, _ := zrd.ApiEndpoint()
|
||||||
zrd.Env = &environment.Environment{Token: token, ZId: resp.Payload.Identity, ApiEndpoint: apiEndpoint}
|
zrd.Env = &env_v0_3.Environment{Token: token, ZId: resp.Payload.Identity, ApiEndpoint: apiEndpoint}
|
||||||
if err := zrd.Save(); err != nil {
|
if err := zrd.Save(); err != nil {
|
||||||
if !cmd.headless && prg != nil {
|
if !cmd.headless && prg != nil {
|
||||||
prg.Send(fmt.Sprintf("there was an error saving the new environment: %v", err))
|
prg.Send(fmt.Sprintf("there was an error saving the new environment: %v", err))
|
||||||
@ -131,7 +131,7 @@ func (cmd *enableCommand) run(_ *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
if err := environment.SaveZitiIdentity("backend", resp.Payload.Cfg); err != nil {
|
if err := env_v0_3.SaveZitiIdentity("backend", resp.Payload.Cfg); err != nil {
|
||||||
if !cmd.headless && prg != nil {
|
if !cmd.headless && prg != nil {
|
||||||
prg.Send(fmt.Sprintf("there was an error writing the environment: %v", err))
|
prg.Send(fmt.Sprintf("there was an error writing the environment: %v", err))
|
||||||
prg.Quit()
|
prg.Quit()
|
||||||
|
@ -2,13 +2,13 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/charmbracelet/bubbles/textinput"
|
"github.com/charmbracelet/bubbles/textinput"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
"github.com/openziti/zrok/environment"
|
|
||||||
"github.com/openziti/zrok/rest_client_zrok/account"
|
"github.com/openziti/zrok/rest_client_zrok/account"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/metadata"
|
"github.com/openziti/zrok/rest_client_zrok/metadata"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
"github.com/openziti/zrok/rest_model_zrok"
|
||||||
@ -42,7 +42,7 @@ func newInviteCommand() *inviteCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cmd *inviteCommand) run(_ *cobra.Command, _ []string) {
|
func (cmd *inviteCommand) run(_ *cobra.Command, _ []string) {
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tui.Error("error loading environment", err)
|
tui.Error("error loading environment", err)
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
httptransport "github.com/go-openapi/runtime/client"
|
httptransport "github.com/go-openapi/runtime/client"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/share"
|
"github.com/openziti/zrok/rest_client_zrok/share"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
"github.com/openziti/zrok/rest_model_zrok"
|
||||||
"github.com/openziti/zrok/tui"
|
"github.com/openziti/zrok/tui"
|
||||||
@ -31,7 +31,7 @@ func newReleaseCommand() *releaseCommand {
|
|||||||
|
|
||||||
func (cmd *releaseCommand) run(_ *cobra.Command, args []string) {
|
func (cmd *releaseCommand) run(_ *cobra.Command, args []string) {
|
||||||
shrToken := args[0]
|
shrToken := args[0]
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !panicInstead {
|
if !panicInstead {
|
||||||
tui.Error("unable to load environment", err)
|
tui.Error("unable to load environment", err)
|
||||||
|
@ -2,7 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
httptransport "github.com/go-openapi/runtime/client"
|
httptransport "github.com/go-openapi/runtime/client"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/model"
|
"github.com/openziti/zrok/model"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/share"
|
"github.com/openziti/zrok/rest_client_zrok/share"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
"github.com/openziti/zrok/rest_model_zrok"
|
||||||
@ -60,7 +60,7 @@ func (cmd *reserveCommand) run(_ *cobra.Command, args []string) {
|
|||||||
target = args[1]
|
target = args[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !panicInstead {
|
if !panicInstead {
|
||||||
tui.Error("error loading environment", err)
|
tui.Error("error loading environment", err)
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/openziti/zrok/endpoints/proxy"
|
"github.com/openziti/zrok/endpoints/proxy"
|
||||||
"github.com/openziti/zrok/endpoints/tcpTunnel"
|
"github.com/openziti/zrok/endpoints/tcpTunnel"
|
||||||
"github.com/openziti/zrok/endpoints/udpTunnel"
|
"github.com/openziti/zrok/endpoints/udpTunnel"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/model"
|
"github.com/openziti/zrok/model"
|
||||||
"github.com/openziti/zrok/rest_client_zrok"
|
"github.com/openziti/zrok/rest_client_zrok"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/share"
|
"github.com/openziti/zrok/rest_client_zrok/share"
|
||||||
@ -78,7 +78,7 @@ func (cmd *sharePrivateCommand) run(_ *cobra.Command, args []string) {
|
|||||||
tui.Error(fmt.Sprintf("invalid backend mode '%v'; expected {proxy, web, tcpTunnel}", cmd.backendMode), nil)
|
tui.Error(fmt.Sprintf("invalid backend mode '%v'; expected {proxy, web, tcpTunnel}", cmd.backendMode), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !panicInstead {
|
if !panicInstead {
|
||||||
tui.Error("unable to load environment", err)
|
tui.Error("unable to load environment", err)
|
||||||
@ -90,7 +90,7 @@ func (cmd *sharePrivateCommand) run(_ *cobra.Command, args []string) {
|
|||||||
tui.Error("unable to load environment; did you 'zrok enable'?", nil)
|
tui.Error("unable to load environment; did you 'zrok enable'?", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
zif, err := environment.ZitiIdentityFile("backend")
|
zif, err := env_v0_3.ZitiIdentityFile("backend")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !panicInstead {
|
if !panicInstead {
|
||||||
tui.Error("unable to load ziti identity configuration", err)
|
tui.Error("unable to load ziti identity configuration", err)
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
httptransport "github.com/go-openapi/runtime/client"
|
httptransport "github.com/go-openapi/runtime/client"
|
||||||
"github.com/openziti/zrok/endpoints"
|
"github.com/openziti/zrok/endpoints"
|
||||||
"github.com/openziti/zrok/endpoints/proxy"
|
"github.com/openziti/zrok/endpoints/proxy"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/model"
|
"github.com/openziti/zrok/model"
|
||||||
"github.com/openziti/zrok/rest_client_zrok"
|
"github.com/openziti/zrok/rest_client_zrok"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/share"
|
"github.com/openziti/zrok/rest_client_zrok/share"
|
||||||
@ -72,7 +72,7 @@ func (cmd *sharePublicCommand) run(_ *cobra.Command, args []string) {
|
|||||||
tui.Error(fmt.Sprintf("invalid backend mode '%v'; expected {proxy, web}", cmd.backendMode), nil)
|
tui.Error(fmt.Sprintf("invalid backend mode '%v'; expected {proxy, web}", cmd.backendMode), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !panicInstead {
|
if !panicInstead {
|
||||||
tui.Error("unable to load environment", err)
|
tui.Error("unable to load environment", err)
|
||||||
@ -84,7 +84,7 @@ func (cmd *sharePublicCommand) run(_ *cobra.Command, args []string) {
|
|||||||
tui.Error("unable to load environment; did you 'zrok enable'?", nil)
|
tui.Error("unable to load environment; did you 'zrok enable'?", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
zif, err := environment.ZitiIdentityFile("backend")
|
zif, err := env_v0_3.ZitiIdentityFile("backend")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !panicInstead {
|
if !panicInstead {
|
||||||
tui.Error("unable to load ziti identity configuration", err)
|
tui.Error("unable to load ziti identity configuration", err)
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
httptransport "github.com/go-openapi/runtime/client"
|
httptransport "github.com/go-openapi/runtime/client"
|
||||||
"github.com/openziti/zrok/endpoints"
|
"github.com/openziti/zrok/endpoints"
|
||||||
"github.com/openziti/zrok/endpoints/proxy"
|
"github.com/openziti/zrok/endpoints/proxy"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/metadata"
|
"github.com/openziti/zrok/rest_client_zrok/metadata"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/share"
|
"github.com/openziti/zrok/rest_client_zrok/share"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
"github.com/openziti/zrok/rest_model_zrok"
|
||||||
@ -44,7 +44,7 @@ func (cmd *shareReservedCommand) run(_ *cobra.Command, args []string) {
|
|||||||
shrToken := args[0]
|
shrToken := args[0]
|
||||||
var target string
|
var target string
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !panicInstead {
|
if !panicInstead {
|
||||||
tui.Error("error loading environment", err)
|
tui.Error("error loading environment", err)
|
||||||
@ -78,7 +78,7 @@ func (cmd *shareReservedCommand) run(_ *cobra.Command, args []string) {
|
|||||||
target = resp.Payload.BackendProxyEndpoint
|
target = resp.Payload.BackendProxyEndpoint
|
||||||
}
|
}
|
||||||
|
|
||||||
zif, err := environment.ZitiIdentityFile("backend")
|
zif, err := env_v0_3.ZitiIdentityFile("backend")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !panicInstead {
|
if !panicInstead {
|
||||||
tui.Error("unable to load ziti identity configuration", err)
|
tui.Error("unable to load ziti identity configuration", err)
|
||||||
|
@ -3,7 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/jedib0t/go-pretty/v6/table"
|
"github.com/jedib0t/go-pretty/v6/table"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/tui"
|
"github.com/openziti/zrok/tui"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"os"
|
"os"
|
||||||
@ -34,7 +34,7 @@ func newStatusCommand() *statusCommand {
|
|||||||
func (cmd *statusCommand) run(_ *cobra.Command, _ []string) {
|
func (cmd *statusCommand) run(_ *cobra.Command, _ []string) {
|
||||||
_, _ = fmt.Fprintf(os.Stderr, "\n")
|
_, _ = fmt.Fprintf(os.Stderr, "\n")
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tui.Error("error loading environment", err)
|
tui.Error("error loading environment", err)
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
httptransport "github.com/go-openapi/runtime/client"
|
httptransport "github.com/go-openapi/runtime/client"
|
||||||
"github.com/openziti/sdk-golang/ziti"
|
"github.com/openziti/sdk-golang/ziti"
|
||||||
"github.com/openziti/sdk-golang/ziti/edge"
|
"github.com/openziti/sdk-golang/ziti/edge"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/model"
|
"github.com/openziti/zrok/model"
|
||||||
"github.com/openziti/zrok/rest_client_zrok"
|
"github.com/openziti/zrok/rest_client_zrok"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/share"
|
"github.com/openziti/zrok/rest_client_zrok/share"
|
||||||
@ -105,7 +105,7 @@ func (cmd *testLoopPublicCommand) run(_ *cobra.Command, _ []string) {
|
|||||||
type looper struct {
|
type looper struct {
|
||||||
id int
|
id int
|
||||||
cmd *testLoopPublicCommand
|
cmd *testLoopPublicCommand
|
||||||
env *environment.Environment
|
env *env_v0_3.Environment
|
||||||
done chan struct{}
|
done chan struct{}
|
||||||
listener edge.Listener
|
listener edge.Listener
|
||||||
zif string
|
zif string
|
||||||
@ -175,7 +175,7 @@ func (l *looper) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
func (l *looper) startup() {
|
func (l *looper) startup() {
|
||||||
logrus.Infof("starting #%d", l.id)
|
logrus.Infof("starting #%d", l.id)
|
||||||
|
|
||||||
zrd, err := environment.Load()
|
zrd, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ func (l *looper) startup() {
|
|||||||
}
|
}
|
||||||
l.env = zrd.Env
|
l.env = zrd.Env
|
||||||
|
|
||||||
l.zif, err = environment.ZitiIdentityFile("backend")
|
l.zif, err = env_v0_3.ZitiIdentityFile("backend")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
zrok_config "github.com/openziti/zrok/controller/config"
|
zrok_config "github.com/openziti/zrok/controller/config"
|
||||||
"github.com/openziti/zrok/controller/store"
|
"github.com/openziti/zrok/controller/store"
|
||||||
"github.com/openziti/zrok/controller/zrokEdgeSdk"
|
"github.com/openziti/zrok/controller/zrokEdgeSdk"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/model"
|
"github.com/openziti/zrok/model"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -133,7 +133,7 @@ func assertZrokProxyConfigType(edge *rest_management_api_client.ZitiEdgeManageme
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getIdentityId(identityName string) (string, error) {
|
func getIdentityId(identityName string) (string, error) {
|
||||||
zif, err := environment.ZitiIdentityFile(identityName)
|
zif, err := env_v0_3.ZitiIdentityFile(identityName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errors.Wrapf(err, "error opening identity '%v' from environment", identityName)
|
return "", errors.Wrapf(err, "error opening identity '%v' from environment", identityName)
|
||||||
}
|
}
|
||||||
@ -195,7 +195,7 @@ func bootstrapIdentity(name string, edge *rest_management_api_client.ZitiEdgeMan
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errors.Wrapf(err, "error encoding identity config '%v'", name)
|
return "", errors.Wrapf(err, "error encoding identity config '%v'", name)
|
||||||
}
|
}
|
||||||
if err := environment.SaveZitiIdentity(name, out.String()); err != nil {
|
if err := env_v0_3.SaveZitiIdentity(name, out.String()); err != nil {
|
||||||
return "", errors.Wrapf(err, "error saving identity config '%v'", name)
|
return "", errors.Wrapf(err, "error saving identity config '%v'", name)
|
||||||
}
|
}
|
||||||
return zId, nil
|
return zId, nil
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/openziti/sdk-golang/ziti"
|
"github.com/openziti/sdk-golang/ziti"
|
||||||
"github.com/openziti/zrok/endpoints"
|
"github.com/openziti/zrok/endpoints"
|
||||||
"github.com/openziti/zrok/endpoints/publicProxy/notFoundUi"
|
"github.com/openziti/zrok/endpoints/publicProxy/notFoundUi"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/model"
|
"github.com/openziti/zrok/model"
|
||||||
"github.com/openziti/zrok/util"
|
"github.com/openziti/zrok/util"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@ -40,7 +40,7 @@ type Frontend struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewFrontend(cfg *FrontendConfig) (*Frontend, error) {
|
func NewFrontend(cfg *FrontendConfig) (*Frontend, error) {
|
||||||
zCfgPath, err := environment.ZitiIdentityFile(cfg.IdentityName)
|
zCfgPath, err := env_v0_3.ZitiIdentityFile(cfg.IdentityName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error getting ziti identity '%v' from environment", cfg.IdentityName)
|
return nil, errors.Wrapf(err, "error getting ziti identity '%v' from environment", cfg.IdentityName)
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/openziti/zrok/endpoints"
|
"github.com/openziti/zrok/endpoints"
|
||||||
"github.com/openziti/zrok/endpoints/publicProxy/healthUi"
|
"github.com/openziti/zrok/endpoints/publicProxy/healthUi"
|
||||||
"github.com/openziti/zrok/endpoints/publicProxy/notFoundUi"
|
"github.com/openziti/zrok/endpoints/publicProxy/notFoundUi"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/model"
|
"github.com/openziti/zrok/model"
|
||||||
"github.com/openziti/zrok/util"
|
"github.com/openziti/zrok/util"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@ -26,7 +26,7 @@ type httpFrontend struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewHTTP(cfg *Config) (*httpFrontend, error) {
|
func NewHTTP(cfg *Config) (*httpFrontend, error) {
|
||||||
zCfgPath, err := environment.ZitiIdentityFile(cfg.Identity)
|
zCfgPath, err := env_v0_3.ZitiIdentityFile(cfg.Identity)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error getting ziti identity '%v' from environment", cfg.Identity)
|
return nil, errors.Wrapf(err, "error getting ziti identity '%v' from environment", cfg.Identity)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package tcpTunnel
|
|||||||
import (
|
import (
|
||||||
"github.com/openziti/sdk-golang/ziti"
|
"github.com/openziti/sdk-golang/ziti"
|
||||||
"github.com/openziti/zrok/endpoints"
|
"github.com/openziti/zrok/endpoints"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/model"
|
"github.com/openziti/zrok/model"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -29,7 +29,7 @@ func NewFrontend(cfg *FrontendConfig) (*Frontend, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error resolving tcp address '%v'", cfg.BindAddress)
|
return nil, errors.Wrapf(err, "error resolving tcp address '%v'", cfg.BindAddress)
|
||||||
}
|
}
|
||||||
zCfgPath, err := environment.ZitiIdentityFile(cfg.IdentityName)
|
zCfgPath, err := env_v0_3.ZitiIdentityFile(cfg.IdentityName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error getting ziti identity '%v' from environment", cfg.IdentityName)
|
return nil, errors.Wrapf(err, "error getting ziti identity '%v' from environment", cfg.IdentityName)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package udpTunnel
|
|||||||
import (
|
import (
|
||||||
"github.com/openziti/sdk-golang/ziti"
|
"github.com/openziti/sdk-golang/ziti"
|
||||||
"github.com/openziti/zrok/endpoints"
|
"github.com/openziti/zrok/endpoints"
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/model"
|
"github.com/openziti/zrok/model"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -99,7 +99,7 @@ func NewFrontend(cfg *FrontendConfig) (*Frontend, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error resolving udp address '%v'", cfg.BindAddress)
|
return nil, errors.Wrapf(err, "error resolving udp address '%v'", cfg.BindAddress)
|
||||||
}
|
}
|
||||||
zCfgPath, err := environment.ZitiIdentityFile(cfg.IdentityName)
|
zCfgPath, err := env_v0_3.ZitiIdentityFile(cfg.IdentityName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error getting ziti identity '%v' from environment", cfg.IdentityName)
|
return nil, errors.Wrapf(err, "error getting ziti identity '%v' from environment", cfg.IdentityName)
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package environment
|
package env_v0_3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-openapi/runtime"
|
"github.com/go-openapi/runtime"
|
@ -1,4 +1,4 @@
|
|||||||
package environment
|
package env_v0_3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
@ -1,4 +1,4 @@
|
|||||||
package environment
|
package env_v0_3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
@ -1,4 +1,4 @@
|
|||||||
package environment
|
package env_v0_3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
@ -1,4 +1,4 @@
|
|||||||
package environment
|
package env_v0_3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
@ -1,4 +1,4 @@
|
|||||||
package environment
|
package env_v0_3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
@ -1,7 +1,7 @@
|
|||||||
package sdk
|
package sdk
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openziti/zrok/environment"
|
"github.com/openziti/zrok/environment/env_v0_3"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
"github.com/openziti/zrok/rest_model_zrok"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
@ -29,14 +29,14 @@ func newPublicShare(request *ShareRequest) (*Share, error) {
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadEnvironment(request *ShareRequest) (*environment.Root, error) {
|
func loadEnvironment(request *ShareRequest) (*env_v0_3.Root, error) {
|
||||||
env, err := environment.Load()
|
env, err := env_v0_3.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "error loading environment")
|
return nil, errors.Wrap(err, "error loading environment")
|
||||||
}
|
}
|
||||||
return env, nil
|
return env, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func createShare(zrd *environment.Root, req *rest_model_zrok.ShareRequest) (*Share, error) {
|
func createShare(zrd *env_v0_3.Root, req *rest_model_zrok.ShareRequest) (*Share, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user