-
Notifications
You must be signed in to change notification settings - Fork 95
Routing un-authenticated api calls to nyc1 #529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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" |
There was a problem hiding this comment.
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.
client.Region = "LON1" |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
client.Region = "LON1" |
Copilot uses AI. Check for mistakes.
There was a problem hiding this 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
No description provided.