added ssh param to force git+ssh cloning

This commit is contained in:
Brad Rydzewski 2015-10-02 16:02:37 -07:00
parent 7f3e4de836
commit 4435d7f2f6

View file

@ -32,6 +32,7 @@ type Github struct {
Open bool Open bool
PrivateMode bool PrivateMode bool
SkipVerify bool SkipVerify bool
GitSSH bool
} }
func Load(env envconfig.Env) *Github { func Load(env envconfig.Env) *Github {
@ -56,6 +57,7 @@ func Load(env envconfig.Env) *Github {
github.PrivateMode, _ = strconv.ParseBool(params.Get("private_mode")) github.PrivateMode, _ = strconv.ParseBool(params.Get("private_mode"))
github.SkipVerify, _ = strconv.ParseBool(params.Get("skip_verify")) github.SkipVerify, _ = strconv.ParseBool(params.Get("skip_verify"))
github.Open, _ = strconv.ParseBool(params.Get("open")) github.Open, _ = strconv.ParseBool(params.Get("open"))
github.GitSSH, _ = strconv.ParseBool(params.Get("ssh"))
if github.URL == DefaultURL { if github.URL == DefaultURL {
github.API = DefaultAPI github.API = DefaultAPI
@ -153,6 +155,11 @@ func (g *Github) Repo(u *model.User, owner, name string) (*model.Repo, error) {
if g.PrivateMode { if g.PrivateMode {
repo.IsPrivate = true repo.IsPrivate = true
} }
if g.GitSSH && repo.IsPrivate {
repo.Clone = *repo_.SSHURL
}
return repo, err return repo, err
} }