Skip to content

Commit

Permalink
fix(gateway): Use public url for Gateway < v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
flemzord committed Jan 22, 2024
1 parent d1368f0 commit 932ab67
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions components/operator/internal/modules/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/sha256"
"encoding/base64"
"fmt"
"golang.org/x/mod/semver"
"sort"
"strings"

Expand Down Expand Up @@ -557,10 +558,17 @@ func (r *serviceReconciler) createContainer(ctx ContainerResolutionConfiguration
)
}

if serviceName == "gateway" && r.Versions.Spec.Gateway < "v2.0.0-alpha" {
env = env.Append(
Env(fmt.Sprintf("%sSTACK_URL", r.service.EnvPrefix), r.Stack.PublicURL()),
)
if serviceName == "gateway" {
switch semver.Compare(r.Versions.Spec.Gateway, "v2.0.0-alpha") {
case -1:
env = env.Append(
Env(fmt.Sprintf("%sSTACK_URL", r.service.EnvPrefix), r.Stack.PublicURL()),
)
default:
env = env.Append(
Env(fmt.Sprintf("%sSTACK_URL", r.service.EnvPrefix), r.Stack.URL()),
)
}
} else {
env = env.Append(
Env(fmt.Sprintf("%sSTACK_URL", r.service.EnvPrefix), r.Stack.URL()),
Expand Down

0 comments on commit 932ab67

Please sign in to comment.