Skip to content

Commit

Permalink
added option to mirror to specific org or user in gitea and gogs
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperspencer committed Oct 11, 2022
1 parent 041a5a8 commit 99ad5cc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions conf.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,12 @@ destination:
gitea:
- token: some-token
# token_file: token.txt # alternatively, specify token in a file
user: some-nome # can be a user or an organization, it must exist on the system
url: http(s)://url-to-gitea
gogs:
- token: some-token
# token_file: token.txt # alternatively, specify token in a file
user: some-nome # can be a user or an organization, it must exist on the system
url: http(s)://url-to-gogs
gitlab:
- token: some-token
Expand Down
10 changes: 10 additions & 0 deletions gitea/gitea.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ func Backup(r types.Repo, d types.GenRepo, dry bool) {
Msg(err.Error())
}

if d.User != "" {
user, _, err = giteaclient.GetUserInfo(d.User)
if err != nil {
log.Fatal().
Str("stage", "gitea").
Str("url", d.URL).
Msg(err.Error())
}
}

if dry {
return
}
Expand Down
10 changes: 10 additions & 0 deletions gogs/gogs.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ func Backup(r types.Repo, d types.GenRepo, dry bool) {
Msg(err.Error())
}

if d.User != "" {
user, err = gogsclient.GetUserInfo(d.User)
if err != nil {
log.Fatal().
Str("stage", "gogs").
Str("url", d.URL).
Msgf("couldn't find %s", d.User)
}
}

if dry {
return
}
Expand Down

0 comments on commit 99ad5cc

Please sign in to comment.