mirror of
https://gitea.com/gitea/tea.git
synced 2026-02-22 06:13:32 +01:00
fix: authentication via env variables repo argument (#809)
--------- Co-authored-by: techknowlogick <techknowlogick@gitea.com> Reviewed-on: https://gitea.com/gitea/tea/pulls/809 Co-authored-by: Nikolaos Karaolidis <nick@karaolidis.com> Co-committed-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
committed by
techknowlogick
parent
fab70f83c1
commit
e3c550ff22
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
// contextFromLocalRepo discovers login & repo slug from the default branch remote of the given local repo
|
||||
func contextFromLocalRepo(repoPath, remoteValue string) (*git.TeaRepo, *config.Login, string, error) {
|
||||
func contextFromLocalRepo(repoPath, remoteValue string, extraLogins []config.Login) (*git.TeaRepo, *config.Login, string, error) {
|
||||
repo, err := git.RepoFromPath(repoPath)
|
||||
if err != nil {
|
||||
return nil, nil, "", err
|
||||
@@ -69,6 +69,10 @@ func contextFromLocalRepo(repoPath, remoteValue string) (*git.TeaRepo, *config.L
|
||||
if err != nil {
|
||||
return repo, nil, "", err
|
||||
}
|
||||
// Prepend extra logins (e.g. from env vars) so they are matched first
|
||||
if len(extraLogins) > 0 {
|
||||
logins = append(extraLogins, logins...)
|
||||
}
|
||||
for _, u := range remoteConfig.URLs {
|
||||
if l, p, err := MatchLogins(u, logins); err == nil {
|
||||
return repo, l, p, nil
|
||||
|
||||
Reference in New Issue
Block a user