Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion cmd/common/fetchService.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func FetchService(serviceName string, verb string, resourceName string, options
steps := []string{
"1. Run 'cfctl login'",
"2. Enter your credentials when prompted",
"3. Select your workspace",
"3. Select your scope",
"4. Try your command again",
}

Expand Down
21 changes: 20 additions & 1 deletion cmd/other/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,17 @@ You can either specify a new endpoint URL directly or use the service-based endp
}

if urlFlag != "" {
// Check if the URL starts with grpc:// or grpc+ssl://
if strings.HasPrefix(urlFlag, "grpc://") || strings.HasPrefix(urlFlag, "grpc+ssl://") {
appV.Set(fmt.Sprintf("environments.%s.endpoint", currentEnv), urlFlag)
if err := appV.WriteConfig(); err != nil {
pterm.Error.Printf("Failed to update setting.yaml: %v\n", err)
return
}
pterm.Success.Printf("Updated endpoint for '%s' to '%s'.\n", currentEnv, urlFlag)
return
}

if strings.HasSuffix(currentEnv, "-app") {
pterm.Error.Println("Direct URL endpoint update is not available for user environment.")
pterm.Info.Println("Please use the service flag (-s) instead.")
Expand Down Expand Up @@ -491,6 +502,12 @@ You can either specify a new endpoint URL directly or use the service-based endp

// If list flag is provided, only show available services
if listFlag {
// Check if environment is local
if currentEnv == "local" {
pterm.Error.Println("Service listing is not available in local environment.")
return
}

token, err := getToken(appV)
if err != nil {
if strings.HasSuffix(currentEnv, "-user") {
Expand Down Expand Up @@ -693,7 +710,9 @@ You can either specify a new endpoint URL directly or use the service-based endp
if service != "" {
var endpoints map[string]string

if strings.HasPrefix(endpoint, "http://") || strings.HasPrefix(endpoint, "https://") {
if strings.HasPrefix(endpoint, "grpc://") || strings.HasPrefix(endpoint, "grpc+ssl://") {
appV.Set(fmt.Sprintf("environments.%s.endpoint", currentEnv), endpoint)
} else if strings.HasPrefix(endpoint, "http://") || strings.HasPrefix(endpoint, "https://") {
// HTTP/HTTPS endpoint case
client := &http.Client{}
req, err := http.NewRequest("POST", restIdentityEndpoint+"/endpoint/list", bytes.NewBuffer([]byte("{}")))
Expand Down
Loading