Merge branch 'master' into internal-state
commit
1a953ea2a4
|
@ -117,6 +117,8 @@ func main() {
|
|||
chanOsSignal = make(chan os.Signal, 1)
|
||||
signal.Notify(chanOsSignal, syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGTERM)
|
||||
|
||||
glog.Infof("Blockbook: %+v", common.GetVersionInfo())
|
||||
|
||||
if *prof != "" {
|
||||
go func() {
|
||||
log.Println(http.ListenAndServe(*prof, nil))
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
UPDATE_VENDOR ?= 1
|
||||
VERSION ?= devel
|
||||
GITCOMMIT = $(shell cd /src && git describe --tags --always --dirty)
|
||||
BUILDTIME = $(shell date --iso-8601=seconds)
|
||||
LDFLAGS := -X blockbook/common.version=$(VERSION) -X blockbook/common.gitcommit=$(GITCOMMIT) -X blockbook/common.buildtime=$(BUILDTIME)
|
||||
|
||||
build: prepare-sources
|
||||
cd $(GOPATH)/src/blockbook && go build -o $(CURDIR)/blockbook -ldflags="-s -w"
|
||||
cd $(GOPATH)/src/blockbook && go build -o $(CURDIR)/blockbook -ldflags="-s -w $(LDFLAGS)"
|
||||
cp $(CURDIR)/blockbook /out/blockbook
|
||||
chown $(PACKAGER) /out/blockbook
|
||||
|
||||
build-debug: prepare-sources
|
||||
cd $(GOPATH)/src/blockbook && go build -o $(CURDIR)/blockbook
|
||||
cd $(GOPATH)/src/blockbook && go build -o $(CURDIR)/blockbook -ldflags="$(LDFLAGS)"
|
||||
cp $(CURDIR)/blockbook /out/blockbook
|
||||
chown $(PACKAGER) /out/blockbook
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ cp -r /src/configs .
|
|||
cp -r /src/static static
|
||||
mkdir cert && cp /src/server/testcert.* cert
|
||||
|
||||
export VERSION=$(dpkg-parsechangelog | sed -rne 's/^Version: ([0-9.]+)([-+~].+)?$/\1/p')
|
||||
|
||||
dpkg-buildpackage -us -uc
|
||||
mv ../*.deb /out
|
||||
chown $PACKAGER /out/*.deb
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package common
|
||||
|
||||
import "runtime"
|
||||
|
||||
var (
|
||||
version = "unknown"
|
||||
gitcommit = "unknown"
|
||||
buildtime = "unknown"
|
||||
)
|
||||
|
||||
type VersionInfo struct {
|
||||
Version string `json:"version"`
|
||||
GitCommit string `json:"gitcommit"`
|
||||
BuildTime string `json:"buildtime"`
|
||||
GoVersion string `json:"goversion"`
|
||||
OSArch string `json:"os/arch"`
|
||||
}
|
||||
|
||||
func GetVersionInfo() VersionInfo {
|
||||
return VersionInfo{
|
||||
Version: version,
|
||||
GitCommit: gitcommit,
|
||||
BuildTime: buildtime,
|
||||
GoVersion: runtime.Version(),
|
||||
OSArch: runtime.GOOS + "/" + runtime.GOARCH,
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ import (
|
|||
"github.com/martinboehm/golang-socketio/transport"
|
||||
)
|
||||
|
||||
const blockbookAbout = "Blockbook v0.0.1, blockchain indexer for TREZOR wallet https://trezor.io/. Do not use for any other purpose."
|
||||
const blockbookAbout = "Blockbook - blockchain indexer for TREZOR wallet https://trezor.io/. Do not use for any other purpose."
|
||||
|
||||
// SocketIoServer is handle to SocketIoServer
|
||||
type SocketIoServer struct {
|
||||
|
@ -140,6 +140,7 @@ func (s *SocketIoServer) apiBlockIndex(w http.ResponseWriter, r *http.Request) {
|
|||
type resBlockIndex struct {
|
||||
BlockHash string `json:"blockHash"`
|
||||
About string `json:"about"`
|
||||
common.VersionInfo
|
||||
}
|
||||
var err error
|
||||
var hash string
|
||||
|
@ -157,7 +158,11 @@ func (s *SocketIoServer) apiBlockIndex(w http.ResponseWriter, r *http.Request) {
|
|||
if err != nil {
|
||||
glog.Error(err)
|
||||
} else {
|
||||
r := resBlockIndex{BlockHash: hash, About: blockbookAbout}
|
||||
r := resBlockIndex{
|
||||
BlockHash: hash,
|
||||
About: blockbookAbout,
|
||||
VersionInfo: common.GetVersionInfo(),
|
||||
}
|
||||
json.NewEncoder(w).Encode(r)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue