Skip to content

Commit

Permalink
enhancement: make cdn url configurable during import
Browse files Browse the repository at this point in the history
  • Loading branch information
mstg committed Sep 5, 2021
1 parent fff8896 commit 360c4d5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/data/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ type ProcessData struct {
ModuleFallbackStream string
AllowStreamBranches bool
FsCreator FsCreatorFunc
CdnUrl string
}
2 changes: 1 addition & 1 deletion pkg/modes/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions pkg/srpmproc/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type ProcessDataRequest struct {
NoStorageUpload bool
NoStorageDownload bool
SingleTag string
CdnUrl string
}

func gitlabify(str string) string {
Expand Down Expand Up @@ -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 == "" {
Expand Down

0 comments on commit 360c4d5

Please sign in to comment.