add BaseURL option to namecheap creds to allow setting sandbox endpoint (#97)

This commit is contained in:
rbelnap 2017-04-25 11:24:55 -04:00 committed by Tom Limoncelli
parent 32fedd8b5f
commit 426c2ed38d
2 changed files with 23 additions and 0 deletions

View file

@ -22,6 +22,22 @@ username and key:
}
{% endhighlight %}
You can optionally specify BaseURL to use a different endpoint - typically the
sandbox:
{% highlight json %}
{
"namecheap.com":{
"apikey": "yourApiKeyFromNameCheap",
"apiuser": "yourUsername"
"BaseURL": "https://api.sandbox.namecheap.com/xml.response"
}
}
{% endhighlight %}
if BaseURL is omitted, the production namecheap url is used.
## Metadata
This provider does not recognize any special metadata fields unique to

View file

@ -27,6 +27,13 @@ func newReg(m map[string]string) (providers.Registrar, error) {
return nil, fmt.Errorf("Namecheap apikey and apiuser must be provided.")
}
api.client = nc.NewClient(api.ApiUser, api.ApiKey, api.ApiUser)
// if BaseURL is specified in creds, use that url
BaseURL, ok := m["BaseURL"]
if ok {
api.client.BaseURL = BaseURL
}
return api, nil
}