Skip to content

Commit

Permalink
Merge pull request #89 from megaport/fix/mpone-dev-env
Browse files Browse the repository at this point in the history
fix: add mpone-dev environment and base url to mp client
  • Loading branch information
MegaportPhilipBrowne authored Jan 15, 2025
2 parents bd4b4d3 + 2fa1556 commit d96cdfe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import (
type Environment string

const (
EnvironmentStaging Environment = "https://api-staging.megaport.com/"
EnvironmentProduction Environment = "https://api.megaport.com/"
EnvironmentStaging Environment = "https://api-staging.megaport.com/"
EnvironmentProduction Environment = "https://api.megaport.com/"
EnvironmentDevelopment Environment = "https://api-mpone-dev.megaport.com"
)

const (
Expand Down Expand Up @@ -404,6 +405,8 @@ func (c *Client) Authorize(ctx context.Context) (*AuthInfo, error) {
tokenURL = "https://auth-m2m.megaport.com/oauth2/token"
} else if c.BaseURL.Host == "api-staging.megaport.com" {
tokenURL = "https://auth-m2m-staging.megaport.com/oauth2/token"
} else if c.BaseURL.Host == "" {
tokenURL = "https://auth-m2m-mpone-dev.megaport.com/oauth2/token"
} else {
return nil, errors.New("unknown API environment")
}
Expand Down

0 comments on commit d96cdfe

Please sign in to comment.