Skip to content

Commit

Permalink
fix: update regex and error message for valid hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
bryankaraffa authored Sep 24, 2024
1 parent 10756d8 commit 9c983ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type (
var (
Config ConfigViper
boolRegexp = regexp.MustCompile(`^(?i:true)$`)
hostRegexp = regexp.MustCompile(`^(?:governance-(\d+)\.(test\.)?rightscale\.com|eu-central-1\.policy-eu\.flexeraeng\.com|api\.eu-central-1\.policy-eu\.flexeraeng\.com|ap-southeast-2\.policy-apac\.flexeraeng\.com|api\.ap-southeast-2\.policy-apac\.flexeraeng\.com)$`)
hostRegexp = regexp.MustCompile(`^(?:governance-(\d+)\.(test\.)?rightscale\.com|eu-central-1\.policy-eu\.flexeraeng\.com|api\.eu-central-1\.policy-eu\.flexeraeng\.com|api\.ap-southeast-2\.policy-apac\.flexeraeng\.com)$`)
hostRegexpDep = regexp.MustCompile(`^(?:eu-central-1\.policy-eu\.flexeraeng\.com)$`)
)

Expand Down Expand Up @@ -257,7 +257,7 @@ func (config *ConfigViper) ShowConfiguration(output io.Writer) error {

func (a *Account) Validate() error {
if !hostRegexp.MatchString(a.Host) {
return fmt.Errorf("invalid host: must be of form governance-<shard number>.rightscale.com or api.eu-central-1.policy-eu.flexeraeng.com")
return fmt.Errorf("invalid host: must be of form governance-3.rightscale.com, governance-4.rightscale.com, api.eu-central-1.policy-eu.flexeraeng.com, or api.ap-southeast-2.policy-apac.flexeraeng.com")
}
if hostRegexpDep.MatchString(a.Host) {
fmt.Fprintln(os.Stderr, "Warning: API endpoint host eu-central-1.policy-eu.flexeraeng.com is deprecated and will be removed soon. Change profile API endpoint host to api.eu-central-1.policy-eu.flexeraeng.com before May 23rd")
Expand Down

0 comments on commit 9c983ee

Please sign in to comment.