Skip to content

Commit

Permalink
Add default file.
Browse files Browse the repository at this point in the history
  • Loading branch information
cxjava committed Nov 28, 2018
1 parent fa5c209 commit 487208c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -568,5 +568,5 @@ go get -d github.com/sipt/shuttle
cd $GOPATH/src/github.com/sipt/shuttle/assets
go generate # package html and GeoLite2-Country.mmdb resources into assets/assets.go
cd $GOPATH/src/github.com/sipt/shuttle/cmd
go build
go build -tags release
```
2 changes: 1 addition & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -594,5 +594,5 @@ go get -d github.com/sipt/shuttle
cd $GOPATH/src/github.com/sipt/shuttle/assets
go generate # 打包HTML和GeoLite2-Country.mmdb到assets/assets.go文件
cd $GOPATH/src/github.com/sipt/shuttle/cmd
go build
go build -tags release
```
17 changes: 17 additions & 0 deletions assets/assets_generate.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// +build !release
//go:generate go run github.com/UnnoTed/fileb0x b0x.yaml

package assets

import (
"io/ioutil"
"net/http"
)

var HTTP http.FileSystem = http.Dir("./")

// ReadFile is adapTed from ioutil
func ReadFile(path string) ([]byte, error) {
f, err := HTTP.Open(path)
if err != nil {
return nil, err
}
return ioutil.ReadAll(f)
}
2 changes: 1 addition & 1 deletion assets/b0x.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dest: "."
fmt: true

# build tags for the main b0x.go file
tags: ""
tags: "release"

# updater allows you to update a b0x in a running server
# without having to restart it
Expand Down

0 comments on commit 487208c

Please sign in to comment.