Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print url for codespaces #456

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
Loading