Support GithubOrg in zoekt-indexserver config
This allows zoekt-indexserver to mirror a github organization's private
repositories using a properly scoped access token.
Change-Id: Ic1ef8c6cad83aebf55f0cea235f362701ef11212
diff --git a/README.md b/README.md
index d375349..9cfb617 100644
--- a/README.md
+++ b/README.md
@@ -68,14 +68,15 @@
cat << EOF > config.json
[{"GithubUser": "username"},
+ {"GithubOrg": "org"},
{"GitilesURL": "https://gerrit.googlesource.com", "Name": "zoekt" }
]
EOF
$GOPATH/bin/zoekt-server -mirror_config config.json
-This will mirror all repos under 'github.com/username' as well as the
-'zoekt' repository. It will index the repositories.
+This will mirror all repos under 'github.com/username', 'github.com/org', as
+well as the 'zoekt' repository. It will index the repositories.
It takes care of fetching and indexing new data and cleaning up logfiles.
diff --git a/cmd/zoekt-indexserver/config.go b/cmd/zoekt-indexserver/config.go
index 7efb9fc..2d513b4 100644
--- a/cmd/zoekt-indexserver/config.go
+++ b/cmd/zoekt-indexserver/config.go
@@ -32,6 +32,7 @@
type ConfigEntry struct {
GithubUser string
+ GithubOrg string
BitBucketServerProject string
GitHubURL string
GitilesURL string
@@ -155,7 +156,7 @@
cfg = randomize(cfg)
for _, c := range cfg {
var cmd *exec.Cmd
- if c.GithubUser != "" {
+ if c.GithubUser != "" || c.GithubOrg != "" {
cmd = exec.Command("zoekt-mirror-github",
"-dest", repoDir)
if c.GitHubURL != "" {
@@ -163,6 +164,8 @@
}
if c.GithubUser != "" {
cmd.Args = append(cmd.Args, "-user", c.GithubUser)
+ } else if c.GithubOrg != "" {
+ cmd.Args = append(cmd.Args, "-org", c.GithubOrg)
}
if c.Name != "" {
cmd.Args = append(cmd.Args, "-name", c.Name)