configure upload URL when github_api_url is set

[#99533974]

Signed-off-by: Corbin Halliwill <challiwill@pivotal.io>
This commit is contained in:
Alex Suraci
2016-02-03 11:02:11 -08:00
committed by Corbin Halliwill
parent da17fb3d2f
commit 91b8f79018
3 changed files with 21 additions and 3 deletions

View File

@@ -19,6 +19,10 @@ Fetches and creates versioned GitHub resources.
* `github_api_url`: *Optional.* If you use a non-public GitHub deployment then
you can set your API URL here.
* `github_uploads_url`: *Optional.* Some GitHub instances have a separate URL
for uploading. If `github_api_url` is set, this value defaults to the same
value, but if you have your own endpoint, this field will override it.
* `drafts`: *Optional. Default `false`.* When set to `true`, `put` produces
drafts and `check` only detects drafts. If `false`, only non-draft releases
will be detected and published. Note that releases must have semver compliant

View File

@@ -55,6 +55,19 @@ func NewGitHubClient(source Source) (*GitHubClient, error) {
if err != nil {
return nil, err
}
client.UploadURL, err = url.Parse(source.GitHubAPIURL)
if err != nil {
return nil, err
}
}
if source.GitHubUploadsURL != "" {
var err error
client.UploadURL, err = url.Parse(source.GitHubUploadsURL)
if err != nil {
return nil, err
}
}
return &GitHubClient{

View File

@@ -5,6 +5,7 @@ type Source struct {
Repository string `json:"repository"`
GitHubAPIURL string `json:"github_api_url"`
GitHubUploadsURL string `json:"github_uploads_url"`
AccessToken string `json:"access_token"`
Drafts bool `json:"drafts"`
}