Addressed PR feedback

This commit is contained in:
Geoff Franks 2016-11-16 17:18:17 -05:00
commit 5ae62570ab
3 changed files with 9 additions and 6 deletions

View File

@ -24,7 +24,7 @@ func main() {
log.Infof("genesis-index starting up")
var d *db.DB
if dsn, err := ParseVcap(os.Getenv("VCAP_SERVICES"), "postgresql", "uri"); err == nil {
if dsn, err := ParseVcap(os.Getenv("VCAP_SERVICES"), []string{"postgres", "postgresql"}, "uri"); err == nil {
d, err = Database("postgres", fmt.Sprintf("%s?sslmode=disable", dsn))
if err != nil {
log.Infof("Unable to connect to database: %s", err)

View File

@ -14,7 +14,7 @@ pushd $PIPELINE >/dev/null
disabled=$(curl -Lsk ${GENESIS_INDEX}/v1/release/${release}/metadata | jq -r .disabled)
if [[ ${disabled} == "true" ]]; then
echo skipping $release
# FIXME this isn't enough?
# https://www.youtube.com/watch?v=dDZzl9AyXeg
continue
fi
echo processing $release

11
vcap.go
View File

@ -5,7 +5,7 @@ import (
"fmt"
)
func ParseVcap(src, tag, subkey string) (string, error) {
func ParseVcap(src string, tags []string, subkey string) (string, error) {
var services map[string][]struct {
Credentials map[string]interface{} `json:"credentials"`
@ -25,10 +25,13 @@ func ParseVcap(src, tag, subkey string) (string, error) {
for _, l := range services {
for _, service := range l {
tagged := false
TAGS:
for _, actual := range service.Tags {
if tag == actual {
tagged = true
break
for _, tag := range tags {
if tag == actual {
tagged = true
break TAGS
}
}
}