From e3d3b20f74460d3ad8223dcc644892d99b9e9623 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Wed, 9 Apr 2025 15:09:41 -0400 Subject: [PATCH] incorporate auto-rebase for environments pointed at https://api.zrok.io (#936) --- environment/env_v0_4/root.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/environment/env_v0_4/root.go b/environment/env_v0_4/root.go index e87b8c2b..e8a8e0b7 100644 --- a/environment/env_v0_4/root.go +++ b/environment/env_v0_4/root.go @@ -6,8 +6,10 @@ import ( "github.com/openziti/zrok/environment/env_core" "github.com/openziti/zrok/environment/env_v0_3" "github.com/pkg/errors" + "github.com/sirupsen/logrus" "os" "path/filepath" + "strings" ) const V = "v0.4" @@ -286,6 +288,13 @@ func loadEnvironment() (*env_core.Environment, error) { ZitiIdentity: env.ZId, ApiEndpoint: env.ApiEndpoint, } + if strings.HasPrefix(env.ApiEndpoint, "https://api.zrok.io") { + out.ApiEndpoint = "https://api-v1.zrok.io" + if err := saveEnvironment(out); err != nil { + return nil, errors.Wrap(err, "error auto-rebasing apiEndpoint") + } + logrus.Info("auto-rebased 'apiEndpoint' for v1.0.x") + } return out, nil }