mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
toggle travis pro/org
This commit is contained in:
parent
985c41d3b6
commit
fa37bc73d0
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user