diff --git a/.gitignore b/.gitignore index 8a57109e0..02dddb494 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ config.yml /gangway vendor/ +cmd/gangway/bindata.go \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index bfaa6a10c..dd47736e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ go: sudo: false install: - - make setup && make deps + - make setup && make deps && make bindata script: - make check diff --git a/Dockerfile b/Dockerfile index 14f99c52a..b5358ca6b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,11 @@ RUN go get github.com/golang/dep/cmd/dep COPY Gopkg.toml Gopkg.lock ./ RUN dep ensure -v -vendor-only +RUN go get -u github.com/mjibson/esc/... COPY cmd cmd +COPY templates templates +RUN esc -o cmd/gangway/bindata.go templates/ + RUN CGO_ENABLED=0 GOOS=linux go install -ldflags="-w -s" -v github.com/heptiolabs/gangway/... FROM alpine:latest diff --git a/cmd/gangway/bindata.go b/cmd/gangway/bindata.go deleted file mode 100644 index 88822a34f..000000000 --- a/cmd/gangway/bindata.go +++ /dev/null @@ -1,277 +0,0 @@ -// Code generated by "esc -o cmd/gangway/bindata.go templates/"; DO NOT EDIT. - -package main - -import ( - "bytes" - "compress/gzip" - "encoding/base64" - "io/ioutil" - "net/http" - "os" - "path" - "sync" - "time" -) - -type _escLocalFS struct{} - -var _escLocal _escLocalFS - -type _escStaticFS struct{} - -var _escStatic _escStaticFS - -type _escDirectory struct { - fs http.FileSystem - name string -} - -type _escFile struct { - compressed string - size int64 - modtime int64 - local string - isDir bool - - once sync.Once - data []byte - name string -} - -func (_escLocalFS) Open(name string) (http.File, error) { - f, present := _escData[path.Clean(name)] - if !present { - return nil, os.ErrNotExist - } - return os.Open(f.local) -} - -func (_escStaticFS) prepare(name string) (*_escFile, error) { - f, present := _escData[path.Clean(name)] - if !present { - return nil, os.ErrNotExist - } - var err error - f.once.Do(func() { - f.name = path.Base(name) - if f.size == 0 { - return - } - var gr *gzip.Reader - b64 := base64.NewDecoder(base64.StdEncoding, bytes.NewBufferString(f.compressed)) - gr, err = gzip.NewReader(b64) - if err != nil { - return - } - f.data, err = ioutil.ReadAll(gr) - }) - if err != nil { - return nil, err - } - return f, nil -} - -func (fs _escStaticFS) Open(name string) (http.File, error) { - f, err := fs.prepare(name) - if err != nil { - return nil, err - } - return f.File() -} - -func (dir _escDirectory) Open(name string) (http.File, error) { - return dir.fs.Open(dir.name + name) -} - -func (f *_escFile) File() (http.File, error) { - type httpFile struct { - *bytes.Reader - *_escFile - } - return &httpFile{ - Reader: bytes.NewReader(f.data), - _escFile: f, - }, nil -} - -func (f *_escFile) Close() error { - return nil -} - -func (f *_escFile) Readdir(count int) ([]os.FileInfo, error) { - return nil, nil -} - -func (f *_escFile) Stat() (os.FileInfo, error) { - return f, nil -} - -func (f *_escFile) Name() string { - return f.name -} - -func (f *_escFile) Size() int64 { - return f.size -} - -func (f *_escFile) Mode() os.FileMode { - return 0 -} - -func (f *_escFile) ModTime() time.Time { - return time.Unix(f.modtime, 0) -} - -func (f *_escFile) IsDir() bool { - return f.isDir -} - -func (f *_escFile) Sys() interface{} { - return f -} - -// FS returns a http.Filesystem for the embedded assets. If useLocal is true, -// the filesystem's contents are instead used. -func FS(useLocal bool) http.FileSystem { - if useLocal { - return _escLocal - } - return _escStatic -} - -// Dir returns a http.Filesystem for the embedded assets on a given prefix dir. -// If useLocal is true, the filesystem's contents are instead used. -func Dir(useLocal bool, name string) http.FileSystem { - if useLocal { - return _escDirectory{fs: _escLocal, name: name} - } - return _escDirectory{fs: _escStatic, name: name} -} - -// FSByte returns the named file from the embedded assets. If useLocal is -// true, the filesystem's contents are instead used. -func FSByte(useLocal bool, name string) ([]byte, error) { - if useLocal { - f, err := _escLocal.Open(name) - if err != nil { - return nil, err - } - b, err := ioutil.ReadAll(f) - _ = f.Close() - return b, err - } - f, err := _escStatic.prepare(name) - if err != nil { - return nil, err - } - return f.data, nil -} - -// FSMustByte is the same as FSByte, but panics if name is not present. -func FSMustByte(useLocal bool, name string) []byte { - b, err := FSByte(useLocal, name) - if err != nil { - panic(err) - } - return b -} - -// FSString is the string version of FSByte. -func FSString(useLocal bool, name string) (string, error) { - b, err := FSByte(useLocal, name) - return string(b), err -} - -// FSMustString is the string version of FSMustByte. -func FSMustString(useLocal bool, name string) string { - return string(FSMustByte(useLocal, name)) -} - -var _escData = map[string]*_escFile{ - - "/templates/commandline.tmpl": { - local: "templates/commandline.tmpl", - size: 4368, - modtime: 1538432349, - compressed: ` -H4sIAAAAAAAC/7RYbVfbuBL+3l8x6+052x6qKFDe2hvn3jSUNi00lIRSOPthZXlii8iSkeS80Mt/v0d2 -AiGkwLnb/VJ3Rh4988yLZ0Ljt71uu3929B5Sl8nms4Z/gGQqCQNUgVcgi5vPABoZOgapcznBy0KMwqCt -lUPlSH+aYwC8ksLA4cRRf82/gKfMWHThSX+f7Ab09hrFMgyDkcBxro1bMB6L2KVhjCPBkZTCKxBKOMEk -sZxJDNdfQcYmIiuyuaJWn13thJPY/MBUMmbTBq3EZ/7kN0Kg3esBEFK+KYUaQmpwEAaekX1L6UArZ2uJ -1olElgtb4zqjgmv17wHLhJyGh8yhEUyudbhWNgCDMgysm0q0KaILbi9ePllC4rG6sDUudREPJDNYIrEL -NqFSRJZmMxxxhbReW6/XaxuU2zv6WiZUjVsbzNgBIXBkhM3m/Cw3IndgDX8ybO7t6XptfbNWr4QS5cIG -IJTDxAg3DQObso2tbXLR/3B10Lrstnj3YK11sLcx2HCj/bOdgd2Ox8Mu6t3diSi+fWTHwzAAbrS12ohE -qDBgSqtppgsbNBu08vOXuMx1lmuFys30JGI2fYBCO90yoy2XtOJvh+105/Qyqp90+ffh19bHL/s9vBJr -9RGtX21PBuOnUvgFyb9DyaWY4ZyO05k2Ro9vcr+C02bvTTE4NuvvL9nJ/j4evqFbGx8+bu9+tOu9aDTZ -xf3v705zuXt11Pk5J6D/CJlcFolQljqtZcTMDatSeojU5GyH9k7YzvYbUz86X5+686P9i43TS9U9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fcRYtGM0IT+rHXU6ZXSyfFBdcjRODHwfYXE95gu5+ZPwYEQzCKMSzu70hWDMSr/s8suf3v+s8I9 -+LOMGCnBSW70SMRoQi1i/pMzwkwSijgnwtoCDSmMLLl1SnFG7AHT6pNBRBxW7nips/c0I4vcoFsw7JUK -b/xzW4MDgzYlTg9RlbbHlabvFQ/binjBrLM3t1gZeP9LeOJW18CsQMKVh4WdnTycq2XQwuIDoEuNsKJj -V7bswjQ0egzlYrJqEbjZP0qntBrcjmyniGQmQRizEVqCg4GfI5VQbmTVMtbc02MlNYvLr37F6fHZfSM2 -aLX3NWj194//BQAA//909ruQEBEAAA== -`, - }, - - "/templates/home.tmpl": { - local: "templates/home.tmpl", - size: 2088, - modtime: 1538420032, - compressed: ` -H4sIAAAAAAAC/4xWUW/jNgx+76/g6V42LLKbuxXYcnaGrd2AYnfrgHYH7JGWGZutLPkkOW5u2H8fJMdJ -mhuwBUgsUhT5kR9ppXh1c3f98OfvP0MbOr2+KOIDNJqmFGREVBDW6wuAoqOA0IbQS/o08LYU19YEMkE+ -7HoSoCapFIGeQx7dvAPVovMUyj8efpHfifzoxmBHpdgyjb114eTwyHVoy5q2rEgmYQFsODBq6RVqKpcL -6PCZu6GbFdnl3nXgoGndoGlG3BX5JF7EnVdSwvX9PYCUyVKzeYLW0aYUMSO/yvONNcFnjbWNJuzZZ8p2 -OStrfthgx3pXfsBAjlF/c6us8QIc6VL4sNPkW6Igjo7Pd84iqdo8+kxpO9QbjY5SJHzE51xz5fNuH4c/ -U36ZLS8vsze58i/0WccmU95PMVOkuALoHWUV+hb+SmL8VKieGmcHU0tltXUrqDSqp3cHg7329bffb6q3 -V0d9LIj0/JlW4DvU+mxnqsoKrq3xVqNffLAGlV28HxTXuFfT4j1X5DCwNfDBGru4oUf8OMA9Gj8pfuLg -gyPs4CM5PNm4toNjcvAbjQvorLG+R0VHFHZLbqPtuAIcgj3qR+tqOTrsV2Cs6/AE+NhyIJn8rGKtpp2/ -L9Iji2TLSlv1tC9fj3XNplnBJSyv+ufZ+tw4m5mRUelPan9SQjYtOQ6zjyLfs1bk04AVla13iU6DW1Aa -vS+F5qYNstIDQfwR4KymUhjccpNqKibai5oPZwxuU/Y9uTRWyIacWBcIXJdC28bKo3rfma/FfLpyaGoZ -rcRxkHC9z6gY9GzoIjRouSZpjeyolvFgbceIaTbPB30UBp0QRHydrVjTIaiPXgxuz0/u13hEWWNAiSrw -FgP5f3VWDSFYE3tdY+9JrAuet17yJNYdmaHIeX3IsMhr3iYScoPT4qSynlTqY2Nlj7WsbBApIzY1PcsK -TSr0F4SckDBnVLl1/M5iu5xtYy9E3sgEclCjeyIj3x6ogF+HipyhQB5+HEJLJrBKjVDk7fLg7yS4s+Pe -2yF6DHh1HtBq8Ms3kBpOrB9a9jAE1hx2MLLW0JLuYWeHOGtzWIKRQxu17hSY0oOP6NMmGrjrydzexBeC -IRXgq7vbm+uvIU5uBvfcGGADwUJDAXxAF6jOiry9OmQzc/L/UpubJde2YSMmhmJbahs5S81x7JVgpEbX -EIy4JS9ps4kQJyHVYpq7dcJ5a05H4QWsmdDzLkqLqD3cQnCvHPfB7y8inyTwTp3cD7am7PHTQG6XroZp -Kd9ky2yZ3vyPXqyLfDr6hZfHlzfFf9nGy/XMKCGfXkdFPv0tuPgnAAD//yEDNLMoCAAA -`, - }, - - "/templates/kubeconfig.tmpl": { - local: "templates/kubeconfig.tmpl", - size: 606, - modtime: 1538432349, - compressed: ` -H4sIAAAAAAAC/3SRQU8DIRCF7/yKSe+YmBgP3JrWQxNjTKveEWbbSVvYDNBo6v53Ayy6NfXGG76Z9wZ0 -T2/IgbxTcLoV5pBCRA5KSBjPSgAAGORIHRkdUeoUd54pfkqro1ZwPsPNosKLOXzBuw54f4fOwDCU5oB8 -QlYwy+T8ebUp+nX9CMMwEwBOH/FizJM+Ym423kX8iDVOPY9xxmzXmvJ9Cu3y4ajpUMv/2yRmdFE2i2vM -npxVsPCuo63oGTtkdAaDgvMgsl0J+Wsx8S1hSqz8crJnfyLbSpAX62jbVN6NchiyLUeWq2VbbYIENIxx -im1KZYqSldHv0VVqtXzJ4hLoJYWQkGXiw4gVXT/oB2TsGMNuOm5dS39m1kfwZM13AAAA//824BX7XgIA -AA== -`, - }, - - "/": { - isDir: true, - local: "", - }, - - "/templates": { - isDir: true, - local: "templates", - }, -}