Rename remote to forge (#1357)

As of #745

Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
qwerty287
2022-11-05 00:35:06 +01:00
committed by GitHub
parent 2ee75dbceb
commit 3372d1a87c
135 changed files with 750 additions and 698 deletions

View File

@@ -21,9 +21,9 @@ import (
"github.com/rs/zerolog/log"
"github.com/woodpecker-ci/woodpecker/server"
"github.com/woodpecker-ci/woodpecker/server/forge"
"github.com/woodpecker-ci/woodpecker/server/model"
"github.com/woodpecker-ci/woodpecker/server/pipeline"
"github.com/woodpecker-ci/woodpecker/server/remote"
"github.com/woodpecker-ci/woodpecker/server/store"
)
@@ -39,12 +39,12 @@ func handlePipelineErr(c *gin.Context, err error) {
}
}
// if the remote has a refresh token, the current access token may be stale.
// if the forge has a refresh token, the current access token may be stale.
// Therefore, we should refresh prior to dispatching the job.
func refreshUserToken(c *gin.Context, user *model.User) {
_remote := server.Config.Services.Remote
_forge := server.Config.Services.Forge
_store := store.FromContext(c)
if refresher, ok := _remote.(remote.Refresher); ok {
if refresher, ok := _forge.(forge.Refresher); ok {
ok, err := refresher.Refresh(c, user)
if err != nil {
log.Error().Err(err).Msgf("refresh oauth token of user '%s' failed", user.Login)