Skip to content

Commit

Permalink
print url for codespaces (#456)
Browse files Browse the repository at this point in the history
Signed-off-by: Manabu McCloskey <[email protected]>
  • Loading branch information
nabuskey authored Nov 20, 2024
1 parent 8c6cd97 commit d14289a
Showing 1 changed file with 31 additions and 12 deletions.
43 changes: 31 additions & 12 deletions pkg/cmd/create/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net/url"
"os"
"path/filepath"
"strings"

Expand Down Expand Up @@ -160,18 +161,7 @@ func create(cmd *cobra.Command, args []string) error {
return err
}

subDomain := "argocd."
subPath := ""

if pathRouting == true {
subDomain = ""
subPath = "argocd"
}

fmt.Print("\n\n########################### Finished Creating IDP Successfully! ############################\n\n\n")
fmt.Printf("Can Access ArgoCD at %s\nUsername: admin\n", fmt.Sprintf("%s://%s%s:%s/%s", protocol, subDomain, host, port, subPath))
fmt.Print(`Password can be retrieved by running: idpbuilder get secrets -p argocd`, "\n")

printSuccessMsg()
return nil
}

Expand Down Expand Up @@ -224,3 +214,32 @@ func getPackageCustomFile(input string) (v1alpha1.PackageCustomization, error) {
FilePath: paths[0],
}, nil
}

func printSuccessMsg() {
subDomain := "argocd."
subPath := ""

if pathRouting == true {
subDomain = ""
subPath = "argocd"
}

var argoURL string

proxy := behindProxy()
if proxy {
argoURL = fmt.Sprintf("https://%s/argocd", host)
} else {
argoURL = fmt.Sprintf("%s://%s%s:%s/%s", protocol, subDomain, host, port, subPath)
}

fmt.Print("\n\n########################### Finished Creating IDP Successfully! ############################\n\n\n")
fmt.Printf("Can Access ArgoCD at %s\nUsername: admin\n", argoURL)
fmt.Print(`Password can be retrieved by running: idpbuilder get secrets -p argocd`, "\n")
}

func behindProxy() bool {
// check if we are in codespaces: https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace
_, ok := os.LookupEnv("CODESPACES")
return ok
}

0 comments on commit d14289a

Please sign in to comment.