Skip to content

Commit be266a3

Browse files
author
Robin Diddams
authored
Merge pull request #116 from pinpt/GOLD-400
GOLD-400 Add webhook service to backend url
2 parents 0a6e2c8 + 8b0d604 commit be266a3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

api/api.go

+6
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ const (
9292
RegistryService = "registry.api"
9393
// GraphService is the graph service endpoint
9494
GraphService = "graph.api"
95+
// WebhookService is the webhook service endpoint
96+
WebhookService = "webhook.api"
9597
)
9698

9799
// BackendURL return the base url to the API server
@@ -112,6 +114,8 @@ func BackendURL(subdomain string, channel string) string {
112114
return os.Getenv("PP_REGISTRY_SERVICE")
113115
case GraphService:
114116
return os.Getenv("PP_GRAPHQL_SERVICE")
117+
case WebhookService:
118+
return os.Getenv("PP_WEBHOOK_SERVICE")
115119
}
116120
case "stable", "":
117121
return fmt.Sprintf("https://%s.%s", subdomain, baseURL)
@@ -129,6 +133,8 @@ func BackendURL(subdomain string, channel string) string {
129133
return fmt.Sprintf("https://%s.%s:8444/", subdomain, devbaseURL)
130134
case GraphService:
131135
return fmt.Sprintf("https://%s.%s:3010/", subdomain, devbaseURL)
136+
case WebhookService:
137+
return fmt.Sprintf("https://%s.%s:8454/", subdomain, devbaseURL)
132138
}
133139
}
134140
return fmt.Sprintf("https://%s.%s.%s", subdomain, channel, baseURL)

api/api_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ func TestBackendURL(t *testing.T) {
2222
assert.Equal("https://auth.api.pinpoint.com/", BackendURL(AuthService, "stable"))
2323
assert.Equal("https://app.pinpoint.com/", BackendURL(AppService, "stable"))
2424
assert.Equal("https://app.edge.pinpoint.com/", BackendURL(AppService, "edge"))
25+
assert.Equal("https://webhook.api.edge.pinpoint.com/", BackendURL(WebhookService, "edge"))
26+
assert.Equal("https://webhook.api.pinpoint.com/", BackendURL(WebhookService, "stable"))
27+
assert.Equal("https://webhook.api.ppoint.io:8454/", BackendURL(WebhookService, "dev"))
2528
}
2629

2730
func TestSetHeaders(t *testing.T) {

0 commit comments

Comments
 (0)