Skip to content

Commit

Permalink
Limit the set of downloaders
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed Feb 23, 2016
1 parent c7661b1 commit 5ee75e2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions client/getter/getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ var (
// and the lock is used to guard access to it.
getters map[string]gg.Getter
lock sync.Mutex

// supported is the set of download schemes supported by Nomad
supported = []string{"http", "https", "s3"}
)

// getClient returns a client that is suitable for Nomad.
Expand All @@ -28,12 +31,12 @@ func getClient(src, dst string) *gg.Client {

// Return the pre-initialized client
if getters == nil {
getters = make(map[string]gg.Getter, len(gg.Getters))
for k, v := range gg.Getters {
getters[k] = v
getters = make(map[string]gg.Getter, len(supported))
for _, getter := range supported {
if impl, ok := gg.Getters[getter]; ok {
getters[getter] = impl
}
}

getters["file"] = &gg.FileGetter{Copy: true}
}

return &gg.Client{
Expand Down

0 comments on commit 5ee75e2

Please sign in to comment.