Skip to content

Conversation

uzaxirr
Copy link
Contributor

@uzaxirr uzaxirr commented Apr 1, 2025

No description provided.

@uzaxirr uzaxirr requested a review from Copilot April 1, 2025 08:43
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR routes un-authenticated API calls to the LON1 region by explicitly setting the client's region in the Civo API client configuration.

  • Update CheckAPPName to set client.Region to "LON1"
  • Update ListDefaultApps to set client.Region to "LON1"

utility/check.go Outdated
@@ -76,6 +76,7 @@ func GetK3sSize() ([]string, error) {
// CheckAPPName is a function to check if the app name is valid
func CheckAPPName(appName string) bool {
client, err := config.CivoAPIClient()
client.Region = "LON1"
Copy link
Preview

Copilot AI Apr 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The region is set on the client before the error is checked, which can lead to a nil pointer dereference if config.CivoAPIClient() returns an error. Please move the error check before setting client.Region.

Suggested change
client.Region = "LON1"

Copilot uses AI. Check for mistakes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No err check after creating the client?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are doing it, see blelow

utility/check.go Outdated
@@ -97,6 +98,7 @@ func CheckAPPName(appName string) bool {
// ListDefaultApps is a function to list the default apps in the marketplace
func ListDefaultApps() ([]string, error) {
client, err := config.CivoAPIClient()
client.Region = "LON1"
Copy link
Preview

Copilot AI Apr 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The client.Region assignment happens before the error is validated, which could cause issues if the client is nil. Consider checking the error first.

Suggested change
client.Region = "LON1"

Copilot uses AI. Check for mistakes.

@uzaxirr uzaxirr requested a review from Copilot April 1, 2025 08:47
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR aims to change the routing for un-authenticated API calls by updating the region configuration.

  • Updated region routing in CheckAPPName and ListDefaultApps functions
  • Modified the client region to a new value

@uzaxirr uzaxirr changed the title Routing un-authenticated api calls to LON1 Routing un-authenticated api calls to nyc1 Apr 1, 2025
@uzaxirr uzaxirr merged commit 8cb7cea into master Apr 1, 2025
1 check passed
@uzaxirr uzaxirr deleted the pvt-issue branch April 1, 2025 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants