@@ -11,6 +11,7 @@ import (
1111 "github.com/stackrox/roxie/internal/deployer"
1212 "github.com/stackrox/roxie/internal/env"
1313 "github.com/stackrox/roxie/internal/logger"
14+ "github.com/stackrox/roxie/internal/types"
1415)
1516
1617func spawnSubshell (d * deployer.Deployer , log * logger.Logger ) error {
@@ -29,45 +30,44 @@ func spawnSubshell(d *deployer.Deployer, log *logger.Logger) error {
2930
3031 env := os .Environ ()
3132
32- endpoint , password , caCertFile , kubeContext , exposure := d .GetDeploymentInfo ()
33+ centralDeploymentInfo := d .GetCentralDeploymentInfo ()
3334
34- if endpoint != "" {
35- env = append (env , fmt .Sprintf ("API_ENDPOINT=%s" , endpoint ))
36- env = append (env , fmt .Sprintf ("ROX_ENDPOINT=%s" , endpoint ))
37- env = append (env , fmt .Sprintf ("ROX_BASE_URL=https://%s" , endpoint ))
35+ if centralDeploymentInfo . Endpoint != "" {
36+ env = append (env , fmt .Sprintf ("API_ENDPOINT=%s" , centralDeploymentInfo . Endpoint ))
37+ env = append (env , fmt .Sprintf ("ROX_ENDPOINT=%s" , centralDeploymentInfo . Endpoint ))
38+ env = append (env , fmt .Sprintf ("ROX_BASE_URL=https://%s" , centralDeploymentInfo . Endpoint ))
3839 }
3940
40- if password != "" {
41- env = append (env , fmt .Sprintf ("ROX_ADMIN_PASSWORD=%s" , password ))
41+ if centralDeploymentInfo . Password != "" {
42+ env = append (env , fmt .Sprintf ("ROX_ADMIN_PASSWORD=%s" , centralDeploymentInfo . Password ))
4243 }
4344
44- if caCertFile != "" {
45- env = append (env , fmt .Sprintf ("ROX_CA_CERT_FILE=%s" , caCertFile ))
45+ if centralDeploymentInfo . CACertFile != "" {
46+ env = append (env , fmt .Sprintf ("ROX_CA_CERT_FILE=%s" , centralDeploymentInfo . CACertFile ))
4647 }
4748
4849 env = append (env , fmt .Sprintf ("ROX_USERNAME=%s" , deployer .AdminUsername ))
4950 env = append (env , "ROXIE_SHELL=1" )
50- env = append (env , fmt .Sprintf ("name=acs@%s" , kubeContext ))
51+ env = append (env , fmt .Sprintf ("name=acs@%s" , centralDeploymentInfo . KubeContext ))
5152
5253 haproxyAvailable := isHAProxyAvailable ()
5354
5455 var haproxyCmd * exec.Cmd
5556 var haproxyConfigPath string
56- var haproxyStarted bool
5757
58- if haproxyAvailable && endpoint != "" && caCertFile != "" {
58+ if haproxyAvailable && centralDeploymentInfo . Endpoint != "" && centralDeploymentInfo . CACertFile != "" {
5959 var err error
60- haproxyCmd , haproxyConfigPath , err = startHAProxy (endpoint , caCertFile , log )
60+ haproxyCmd , haproxyConfigPath , err = startHAProxy (centralDeploymentInfo . Endpoint , centralDeploymentInfo . CACertFile , log )
6161 if err != nil {
6262 log .Warningf ("Failed to start HAProxy: %v" , err )
6363 } else {
6464 env = append (env , fmt .Sprintf ("ROXIE_HAPROXY_CFG_FILE=%s" , haproxyConfigPath ))
65- haproxyStarted = true
65+ centralDeploymentInfo . HAProxyStarted = true
6666 defer cleanupHAProxy (haproxyCmd , haproxyConfigPath )
6767 }
6868 }
6969
70- printBanner (endpoint , exposure , haproxyAvailable , haproxyStarted )
70+ printBanner (centralDeploymentInfo )
7171
7272 shellCmd := exec .Command (shellPath , "-i" )
7373 shellCmd .Env = env
@@ -171,7 +171,7 @@ func isHAProxyAvailable() bool {
171171 return err == nil
172172}
173173
174- func printBanner (endpoint , exposure string , haproxyAvailable , haproxyStarted bool ) {
174+ func printBanner (centralDeploymentInfo deployer. CentralDeploymentInfo ) {
175175 cyan := color .New (color .FgCyan , color .Bold )
176176 cyan .Println ("\n [roxie] Entering a subshell with ACS environment variables set." )
177177 cyan .Println ("[roxie]" )
@@ -181,10 +181,10 @@ func printBanner(endpoint, exposure string, haproxyAvailable, haproxyStarted boo
181181 cyan .Println ("[roxie] * roxcurl /v1/clusters" )
182182 cyan .Println ("[roxie]" )
183183
184- if haproxyStarted {
184+ if centralDeploymentInfo . HAProxyStarted {
185185 cyan .Println ("[roxie] Central UI: http://localhost:8080 (username: admin, password: see $ROX_ADMIN_PASSWORD)" )
186- } else if exposure != "none" && exposure != "" {
187- cyan .Printf ("[roxie] Central UI: https://%s" , endpoint )
186+ } else if centralDeploymentInfo . Exposure != types . ExposureNone {
187+ cyan .Printf ("[roxie] Central UI: https://%s" , centralDeploymentInfo . Endpoint )
188188 } else if ! env .RunningInRoxieContainer {
189189 cyan .Println ("[roxie] Note: Installing haproxy enables automatic HTTP access to Central at http://localhost:8080" )
190190 }
0 commit comments