@@ -2,18 +2,19 @@ package endpoints
22
33import (
44 "fmt"
5- "github.com/bugsnag/bugsnag-cli/pkg/options"
65 "net/url"
76 "strings"
7+
8+ "github.com/bugsnag/bugsnag-cli/pkg/options"
89)
910
1011// Constants defining upload and build endpoint instances.
1112const (
12- HUB_PREFIX = "00000" // API keys starting with this indicate usage of the Hub instance.
13- HUB_UPLOAD = "https://upload.insighthub .smartbear.com"
14- HUB_BUILD = "https://build.insighthub .smartbear.com"
15- BUGSNAG_UPLOAD = "https://upload.bugsnag.com"
16- BUGSNAG_BUILD = "https://build.bugsnag.com"
13+ SECONDARY_API_PREFIX = "00000" // API keys starting with this indicate usage of the secondary instance.
14+ SECONDARY_UPLOAD_ENDPOINT = "https://upload.bugsnag .smartbear.com"
15+ SECONDARY_BUILD_ENDPOINT = "https://build.bugsnag .smartbear.com"
16+ PRIMARY_UPLOAD_ENDPOINT = "https://upload.bugsnag.com"
17+ PRIMARY_BUILD_ENDPOINT = "https://build.bugsnag.com"
1718)
1819
1920// BuildEndpointURL constructs a complete URL from a base URI and optional port.
@@ -63,10 +64,10 @@ func GetDefaultUploadEndpoint(apiKey string, endpointPath string, options option
6364
6465 if options .Upload .UploadAPIRootUrl != "" {
6566 endpoint = options .Upload .UploadAPIRootUrl
66- } else if strings .HasPrefix (apiKey , HUB_PREFIX ) {
67- endpoint = HUB_UPLOAD
67+ } else if strings .HasPrefix (apiKey , SECONDARY_API_PREFIX ) {
68+ endpoint = SECONDARY_UPLOAD_ENDPOINT
6869 } else {
69- endpoint = BUGSNAG_UPLOAD
70+ endpoint = PRIMARY_UPLOAD_ENDPOINT
7071 }
7172
7273 endpoint , err := BuildEndpointURL (endpoint + endpointPath , options .Port )
@@ -95,10 +96,10 @@ func GetDefaultBuildEndpoint(apiKey string, options options.CLI) (string, error)
9596
9697 if options .CreateBuild .BuildApiRootUrl != "" {
9798 endpoint = options .CreateBuild .BuildApiRootUrl
98- } else if strings .HasPrefix (apiKey , HUB_PREFIX ) {
99- endpoint = HUB_BUILD
99+ } else if strings .HasPrefix (apiKey , SECONDARY_API_PREFIX ) {
100+ endpoint = SECONDARY_BUILD_ENDPOINT
100101 } else {
101- endpoint = BUGSNAG_BUILD
102+ endpoint = PRIMARY_BUILD_ENDPOINT
102103 }
103104
104105 endpoint , err := BuildEndpointURL (endpoint , options .Port )
0 commit comments