Skip to content

Commit 167f17e

Browse files
committed
USe helper to get Asset Public URL
Signed-off-by: Simo Sorce <[email protected]>
1 parent 9884ceb commit 167f17e

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

pkg/cmd/server/apis/config/helpers.go

+10
Original file line numberDiff line numberDiff line change
@@ -642,3 +642,13 @@ func CIDRsOverlap(cidr1, cidr2 string) bool {
642642
}
643643
return ipNet1.Contains(ipNet2.IP) || ipNet2.Contains(ipNet1.IP)
644644
}
645+
646+
func GetAssetPublicURL(config *MasterConfig) string {
647+
asset := ""
648+
if config.OAuthConfig != nil {
649+
asset = config.OAuthConfig.AssetPublicURL
650+
} else if config.ExternalOAuthConfig != nil {
651+
asset = config.ExternalOAuthConfig.AssetPublicURL
652+
}
653+
return asset
654+
}

pkg/cmd/server/origin/master.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,7 @@ func (c *MasterConfig) RunOpenShift(stopCh <-chan struct{}) error {
367367
}
368368

369369
func (c *MasterConfig) buildHandlerChain(genericConfig *apiserver.Config) (func(apiHandler http.Handler, kc *apiserver.Config) http.Handler, map[string]apiserver.PostStartHookFunc, error) {
370-
webconsolePublicURL := ""
371-
if c.Options.OAuthConfig != nil {
372-
webconsolePublicURL = c.Options.OAuthConfig.AssetPublicURL
373-
}
370+
webconsolePublicURL := configapi.GetAssetPublicURL(&c.Options)
374371
webconsoleProxyHandler, err := c.newWebConsoleProxy()
375372
if err != nil {
376373
return nil, nil, err

pkg/oc/bootstrap/docker/status.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/spf13/cobra"
1313
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
1414

15-
"github.com/openshift/origin/pkg/cmd/server/apis/config"
15+
configapi "github.com/openshift/origin/pkg/cmd/server/apis/config"
1616
"github.com/openshift/origin/pkg/oc/bootstrap/docker/dockerhelper"
1717
"github.com/openshift/origin/pkg/oc/bootstrap/docker/errors"
1818
"github.com/openshift/origin/pkg/oc/bootstrap/docker/exec"
@@ -145,7 +145,7 @@ func isHealthy(f *clientcmd.Factory) (bool, error) {
145145
return statusCode == 200, nil
146146
}
147147

148-
func status(container *types.ContainerJSON, config *config.MasterConfig) string {
148+
func status(container *types.ContainerJSON, config *configapi.MasterConfig) string {
149149
mountMap := make(map[string]string)
150150
for _, mount := range container.Mounts {
151151
mountMap[mount.Destination] = mount.Source
@@ -165,7 +165,7 @@ func status(container *types.ContainerJSON, config *config.MasterConfig) string
165165
status += fmt.Sprintf("The OpenShift cluster was started %s ago\n\n", duration)
166166
}
167167

168-
status = status + fmt.Sprintf("Web console URL: %s\n", config.OAuthConfig.AssetPublicURL)
168+
status = status + fmt.Sprintf("Web console URL: %s\n", configapi.GetAssetPublicURL(config))
169169
status = status + fmt.Sprintf("\n")
170170

171171
status = status + fmt.Sprintf("Config is at host directory %s\n", mountMap["/var/lib/origin/openshift.local.config"])

0 commit comments

Comments
 (0)