Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Enterprise Support #23

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
Use custom github domain for webhook
  • Loading branch information
floatdrop committed Feb 14, 2014
commit 017560f5f19ffb33a938f0ab7942193a7a06412b
2 changes: 1 addition & 1 deletion pkg/handler/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func RepoCreateGithub(w http.ResponseWriter, r *http.Request, u *User) error {
return err
}

repo, err := NewGitHubRepo(owner, name, githubRepo.Private)
repo, err := NewGitHubRepo(settings.GitHubDomain, owner, name, githubRepo.Private)
if err != nil {
return err
}
Expand Down
15 changes: 7 additions & 8 deletions pkg/model/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const (
)

const (
HostGithub = "github.com"
HostBitbucket = "bitbucket.org"
HostGoogle = "code.google.com"
HostCustom = "custom"
Expand All @@ -25,8 +24,8 @@ const (
)

const (
githubRepoPattern = "git:https://github.com/%s/%s.git"
githubRepoPatternPrivate = "git@github.com:%s/%s.git"
githubRepoPattern = "git:https://%s/%s/%s.git"
githubRepoPatternPrivate = "git@%s:%s/%s.git"
bitbucketRepoPattern = "https://bitbucket.org/%s/%s.git"
bitbucketRepoPatternPrivate = "[email protected]:%s/%s.git"
)
Expand Down Expand Up @@ -122,15 +121,15 @@ func NewRepo(host, owner, name, scm, url string) (*Repo, error) {
}

// Creates a new GitHub repository
func NewGitHubRepo(owner, name string, private bool) (*Repo, error) {
func NewGitHubRepo(domain, owner, name string, private bool) (*Repo, error) {
var url string
switch private {
case false:
url = fmt.Sprintf(githubRepoPattern, owner, name)
url = fmt.Sprintf(githubRepoPattern, domain, owner, name)
case true:
url = fmt.Sprintf(githubRepoPatternPrivate, owner, name)
url = fmt.Sprintf(githubRepoPatternPrivate, domain, owner, name)
}
return NewRepo(HostGithub, owner, name, ScmGit, url)
return NewRepo(domain, owner, name, ScmGit, url)
}

// Creates a new Bitbucket repository
Expand All @@ -142,7 +141,7 @@ func NewBitbucketRepo(owner, name string, private bool) (*Repo, error) {
case true:
url = fmt.Sprintf(bitbucketRepoPatternPrivate, owner, name)
}
return NewRepo(HostGithub, owner, name, ScmGit, url)
return NewRepo(HostBitbucket, owner, name, ScmGit, url)
}

func (r *Repo) DefaultBranch() string {
Expand Down