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

Fix retrieval of port. #255

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 10 additions & 1 deletion exporter/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package exporter

import (
"encoding/csv"
"fmt"
"os"
"strconv"
"strings"

"github.com/cloudfoundry-community/go-cfenv"
Expand Down Expand Up @@ -104,7 +106,14 @@ func GetCloudFoundryRedisBindings() (addrs, passwords, aliases []string) {
func getAlternative(credentials map[string]interface{}, alternatives ...string) string {
for _, key := range alternatives {
if value, ok := credentials[key]; ok {
return value.(string)
switch value.(type) {
case int:
return strconv.Itoa(value)
case float64:
return fmt.Sprintf("%.0f", value)
default:
return value.(string)
}
}
}
return ""
Expand Down