Remove all legacy config
This commit is contained in:
@ -4,7 +4,6 @@ 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"
|
||||
)
|
||||
|
||||
@ -13,36 +12,12 @@ 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
|
||||
}
|
||||
|
||||
func (r *GiteaRemote) GetType() string {
|
||||
return r.info.Type
|
||||
return r.info.Type.String()
|
||||
}
|
||||
|
||||
func (r *GiteaRemote) String() string {
|
||||
@ -52,7 +27,7 @@ func (r *GiteaRemote) String() string {
|
||||
|
||||
func NewGiteaRemote(remoteInfo *info.RemoteInfo) (*GiteaRemote, error) {
|
||||
client, err := gitea.NewClient(remoteInfo.Host,
|
||||
gitea.SetContext(remoteInfo.Ctx),
|
||||
gitea.SetContext(remoteInfo.Context()),
|
||||
gitea.SetToken(remoteInfo.Token),
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user