Skip to content

Commit

Permalink
Add workdir
Browse files Browse the repository at this point in the history
vibhavp committed Mar 18, 2016

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 7d4233c commit f733ada
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import (
"net/http"
"os"
"os/exec"
"path/filepath"
)

type image struct {
@@ -18,9 +19,10 @@ type image struct {
}

var (
conf = flag.String("conf", "", "configuration file to read from")
addr = flag.String("http", ":8080", "http address to listen on")
images []image
conf = flag.String("conf", "", "configuration file to read from")
addr = flag.String("http", ":8080", "http address to listen on")
workdir = flag.String("workdir", ".", "work directory")
images []image
)

func execHook(image, tag string, commands [][]string) {
@@ -106,6 +108,17 @@ func main() {
return
}

path, err := filepath.Abs(*workdir)
if err != nil {
log.Fatal(err)
}

err = os.Chdir(path)
if err != nil {
log.Fatal(err)
}

log.Printf("Reading hooks from %s/%s", path, *conf)
bytes, err := ioutil.ReadFile(*conf)
if err != nil {
log.Fatal(err)

0 comments on commit f733ada

Please sign in to comment.