Skip to content

Commit

Permalink
cmd/marina-pull: add -addr flag
Browse files Browse the repository at this point in the history
  • Loading branch information
sbinet committed Sep 20, 2016
1 parent ad5bb07 commit bf27953
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,13 @@ $> marina-pull piscineri3/go-base:latest
Loaded image: piscineri3/go-base:latest
2016/09/19 16:22:13 pulling "piscineri3/go-base"... [done] (16.304998995s)
```

Note that by default `marina-pull` will try to pull from `piscine.in2p3.fr`.
You may change this behaviour by passing `-addr=example.com` or `-addr=192.168.0.2` as an argument:

```sh
$> marina-pull -addr=19.168.0.2 piscineri3/go-base
2016/09/20 12:41:10 pulling "piscineri3/go-base"...
Loaded image: piscineri3/go-base:latest
2016/09/20 12:41:26 pulling "piscineri3/go-base"... [done] (16.304998995s)
```
8 changes: 6 additions & 2 deletions cmd/marina-pull/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package main

import (
"flag"
"io"
"log"
"net/http"
Expand All @@ -18,15 +19,18 @@ func main() {
}

func run() {
name := os.Args[1]
addr := flag.String("addr", "piscine.in2p3.fr", "address of the marina")
flag.Parse()

name := flag.Arg(0)

start := time.Now()
defer func() {
log.Printf("pulling %q... [done] (%v)", name, time.Since(start))
}()
log.Printf("pulling %q...\n", name)

resp, err := http.Get("http://piscine.in2p3.fr:8080/docker-images/" + name)
resp, err := http.Get("http://" + *addr + ":8080/docker-images/" + name)
if err != nil {
log.Fatalf("marina-get %q: %v\n", name, err)
}
Expand Down

0 comments on commit bf27953

Please sign in to comment.