diff --git a/travisci/client.go b/travisci/client.go index a8ae8b79..b2d9d9cc 100644 --- a/travisci/client.go +++ b/travisci/client.go @@ -9,6 +9,8 @@ import ( "net/http" "net/url" "os" + + "github.com/senorprogrammer/wtf/wtf" ) const APIEnvToken = "WTF_TRAVIS_API_TOKEN" @@ -16,6 +18,9 @@ const APIEnvToken = "WTF_TRAVIS_API_TOKEN" func BuildsFor() (*Builds, error) { builds := &Builds{} + pro := wtf.Config.UBool("wtf.mods.travisci.pro") + travisAPIURL.Host = hosts[pro] + resp, err := travisRequest("builds") if err != nil { return builds, err @@ -29,7 +34,11 @@ func BuildsFor() (*Builds, error) { /* -------------------- Unexported Functions -------------------- */ var ( - travisAPIURL = &url.URL{Scheme: "https", Host: "api.travis-ci.org", Path: "/"} + travisAPIURL = &url.URL{Scheme: "https", Path: "/"} + hosts = map[bool]string{ + false: "api.travis-ci.org", + true: "api.travis-ci.com", + } ) func travisRequest(path string) (*http.Response, error) {