Skip to content

Commit

Permalink
toggle travis pro/org
Browse files Browse the repository at this point in the history
  • Loading branch information
ruggi committed Jul 31, 2018
1 parent 985c41d commit fa37bc7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion travisci/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ import (
"net/http"
"net/url"
"os"

"github.com/senorprogrammer/wtf/wtf"
)

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
Expand All @@ -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) {
Expand Down

0 comments on commit fa37bc7

Please sign in to comment.