Move from --gitlab flags to global --remote flags
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/config"
|
||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/info"
|
||||
)
|
||||
|
||||
@ -12,6 +13,30 @@ type GiteaRemote struct {
|
||||
api *gitea.Client
|
||||
}
|
||||
|
||||
func (r *GiteaRemote) GetInfos(conf config.Config) []info.RemoteInfo {
|
||||
// Prepare infos
|
||||
infos := make([]info.RemoteInfo, len(conf.Giteas))
|
||||
for i, g := range conf.Giteas {
|
||||
// Set Defaults
|
||||
proto := info.CloneProtoSSH
|
||||
if g.CloneProto == info.CloneProtoHTTP {
|
||||
proto = info.CloneProtoHTTP
|
||||
}
|
||||
if g.Name == "" {
|
||||
g.Name = g.Host
|
||||
}
|
||||
|
||||
infos[i] = info.RemoteInfo{
|
||||
Host: g.Host,
|
||||
Name: g.Name,
|
||||
Type: "gitea",
|
||||
Token: g.Token,
|
||||
CloneProto: proto,
|
||||
}
|
||||
}
|
||||
return infos
|
||||
}
|
||||
|
||||
func (r *GiteaRemote) GetInfo() *info.RemoteInfo {
|
||||
return r.info
|
||||
}
|
||||
|
Reference in New Issue
Block a user