Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Client struct {

func New(apiKey, version string) *Client {
baseURL := "https://customer.cloudamqp.com/api"
if envURL := os.Getenv("CLOUDAMQP_URL"); envURL != "" {
if envURL := os.Getenv("CLOUDAMQP_API_URL"); envURL != "" {
baseURL = envURL
}
return &Client{
Expand Down
8 changes: 4 additions & 4 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ func TestNew(t *testing.T) {

func TestNew_WithEnvironmentVariable(t *testing.T) {
// Save original environment variable
originalURL := os.Getenv("CLOUDAMQP_URL")
defer os.Setenv("CLOUDAMQP_URL", originalURL)
originalURL := os.Getenv("CLOUDAMQP_API_URL")
defer os.Setenv("CLOUDAMQP_API_URL", originalURL)

// Test with custom base URL from environment variable
customURL := "https://custom.example.com/api"
os.Setenv("CLOUDAMQP_URL", customURL)
os.Setenv("CLOUDAMQP_API_URL", customURL)

apiKey := "test-api-key"
client := New(apiKey, "test")
Expand All @@ -37,7 +37,7 @@ func TestNew_WithEnvironmentVariable(t *testing.T) {
assert.NotNil(t, client.httpClient)

// Test with empty environment variable (should use default)
os.Setenv("CLOUDAMQP_URL", "")
os.Setenv("CLOUDAMQP_API_URL", "")
client = New(apiKey, "test")

assert.NotNil(t, client)
Expand Down
Loading