We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Example env var provided by Redis service broker. Parser fails for "ports" key with
panic: 1 error(s) decoding: * '[0].Credentials[ports]' expected type 'string', got unconvertible type 'map[string]interface {}' [recovered] panic: 1 error(s) decoding:
{ "redis-lite": [ { "credentials": { "hostname": "10.10.10.1", "password": "abc", "port": "32843", "ports": { "6379/tcp": "32843" } }, "label": "redis-lite", "name": "uptime-redis", "plan": "free", "tags": [ "redis28", "redis", "key-value" ] } ] }
The text was updated successfully, but these errors were encountered:
Seems to work just fine now.
package main import ( "github.com/cloudfoundry-community/go-cfenv" "log" ) func main() { var envvars []string = []string{ "VCAP_APPLICATION={}", `VCAP_SERVICES={ "redis": [ { "name": "redis", "label": "redis", "tags": [ "redis" ], "plan": "free", "credentials": { "hostname": "1.2.3.4", "port": "1234", "password": "secret", "ports": { "6379/tcp": "32843" } } } ] }`, } env := cfenv.Env(envvars) app, err := cfenv.New(env) if err != nil { log.Println("Can not parse content of VCAP_SERVICES environment variable!", err) return } redisService, err := app.Services.WithName("redis") log.Println("Redis service: ", redisService) }
Output of go run main.go is
go run main.go
2015/09/24 12:35:51 Redis service: &{uptime-redis redis [redis] free map[hostname:1.2.3.4 port:1234 password:secret ports:map[6379/tcp:32843]]}
Sorry, something went wrong.
Is this still an issue?
No branches or pull requests
Example env var provided by Redis service broker. Parser fails for "ports" key with
The text was updated successfully, but these errors were encountered: