Skip to content

Commit

Permalink
Uses DBURL when creating stubed api json configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
bonzofenix committed Feb 13, 2025
1 parent 5e52473 commit 05b1c08
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/autoscaler/testhelpers/cf.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package testhelpers

import "encoding/json"
import (
"encoding/json"
"os"
)

func GetDbVcapServices(creds map[string]string, serviceName string, dbType string) (string, error) {
credentials, err := json.Marshal(creds)
Expand All @@ -20,6 +23,8 @@ func GetDbVcapServices(creds map[string]string, serviceName string, dbType strin
}

func GetVcapServices(userProvidedServiceName string, configJson string) string {
dbURL := os.Getenv("DBURL")

return `{
"user-provided": [ {
"tags": [ "` + userProvidedServiceName + `" ],
Expand All @@ -32,7 +37,7 @@ func GetVcapServices(userProvidedServiceName string, configJson string) string {
"autoscaler": [ {
"name": "some-service",
"credentials": {
"uri": "postgres://postgres:postgres@localhost/autoscaler?sslmode=disable"
"uri": "` + dbURL + `"
},
"syslog_drain_url": "",
"tags": [ "policy_db","binding_db", "postgres" ]
Expand Down

0 comments on commit 05b1c08

Please sign in to comment.