enhancement: make cdn url configurable during import

This commit is contained in:
Mustafa Gezen 2021-09-05 02:12:43 +02:00
parent fff8896c47
commit 360c4d5849
Signed by: mustafa
GPG Key ID: DCDF010D946438C1
3 changed files with 6 additions and 1 deletions

View File

@ -53,4 +53,5 @@ type ProcessData struct {
ModuleFallbackStream string
AllowStreamBranches bool
FsCreator FsCreatorFunc
CdnUrl string
}

View File

@ -240,7 +240,7 @@ func (g *GitMode) WriteSource(pd *data.ProcessData, md *data.ModeData) error {
body = fromBlobStorage
log.Printf("downloading %s from blob storage", hash)
} else {
url := fmt.Sprintf("https://git.centos.org/sources/%s/%s/%s", md.Name, branchName, hash)
url := fmt.Sprintf("%s/%s/%s/%s", pd.CdnUrl, md.Name, branchName, hash)
log.Printf("downloading %s", url)
req, err := http.NewRequest("GET", url, nil)

View File

@ -83,6 +83,7 @@ type ProcessDataRequest struct {
NoStorageUpload bool
NoStorageDownload bool
SingleTag string
CdnUrl string
}
func gitlabify(str string) string {
@ -126,6 +127,9 @@ func NewProcessData(req *ProcessDataRequest) (*data.ProcessData, error) {
if req.BranchPrefix == "" {
req.BranchPrefix = "r"
}
if req.CdnUrl == "" {
req.CdnUrl = "https://git.centos.org/sources"
}
// Validate required
if req.Package == "" {