mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-10-18 10:37:09 +00:00
Make downloader type configurable
This commit is contained in:
1 parent
cc30ef3ee2
commit
1afcd68e01
11 files changed
+22
-7
No files matched your search
+10
-2
@@ -227,8 +227,16 @@ func (context *AptlyContext) newDownloader(progress aptly.Progress) aptly.Downlo
|
||||
// If flag is defined prefer it to global setting
|
||||
maxTries = maxTriesFlag.Value.Get().(int)
|
||||
}
|
||||
// return http.NewDownloader(downloadLimit*1024, maxTries, progress)
|
||||
return http.NewGrabDownloader(downloadLimit*1024, maxTries, progress)
|
||||
var downloader string = context.config().Downloader
|
||||
downloaderFlag := context.flags.Lookup("downloader")
|
||||
if downloaderFlag != nil {
|
||||
downloader = downloaderFlag.Value.String()
|
||||
}
|
||||
|
||||
if downloader == "grab" {
|
||||
return http.NewGrabDownloader(downloadLimit*1024, maxTries, progress)
|
||||
}
|
||||
return http.NewDownloader(downloadLimit*1024, maxTries, progress)
|
||||
}
|
||||
|
||||
// Downloader returns instance of current downloader
|
||||
|
||||
Reference in new issue
Block a user