mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
parent
096191ca24
commit
3b0774805c
4 changed files with 45 additions and 3 deletions
9
build.sh
9
build.sh
|
@ -3,6 +3,11 @@
|
||||||
# Put installed packages into ./bin
|
# Put installed packages into ./bin
|
||||||
export GOBIN=$PWD/`dirname $0`/bin
|
export GOBIN=$PWD/`dirname $0`/bin
|
||||||
|
|
||||||
go install -v $PWD/`dirname $0`/cmd/...
|
export BRANCH=`(git symbolic-ref --short HEAD | cut -d'/' -f 3 )|| ""`
|
||||||
|
export BUILD=`git rev-parse --short HEAD || ""`
|
||||||
|
|
||||||
GOOS=js GOARCH=wasm go build -o main.wasm ./cmd/dendritejs
|
export FLAGS="-X github.com/matrix-org/dendrite/internal.branch=$BRANCH -X github.com/matrix-org/dendrite/internal.build=$BUILD"
|
||||||
|
|
||||||
|
go install -trimpath -ldflags "$FLAGS" -v $PWD/`dirname $0`/cmd/...
|
||||||
|
|
||||||
|
GOOS=js GOARCH=wasm go build -trimpath -ldflags "$FLAGS" -o main.wasm ./cmd/dendritejs
|
||||||
|
|
|
@ -17,6 +17,7 @@ package routing
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/matrix-org/dendrite/internal"
|
||||||
"github.com/matrix-org/util"
|
"github.com/matrix-org/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,5 +32,13 @@ type server struct {
|
||||||
|
|
||||||
// Version returns the server version
|
// Version returns the server version
|
||||||
func Version() util.JSONResponse {
|
func Version() util.JSONResponse {
|
||||||
return util.JSONResponse{Code: http.StatusOK, JSON: &version{server{"dev", "Dendrite"}}}
|
return util.JSONResponse{
|
||||||
|
Code: http.StatusOK,
|
||||||
|
JSON: &version{
|
||||||
|
server{
|
||||||
|
Name: "Dendrite",
|
||||||
|
Version: internal.VersionString(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,8 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, useHTTPAPIs boo
|
||||||
internal.SetupHookLogging(cfg.Logging, componentName)
|
internal.SetupHookLogging(cfg.Logging, componentName)
|
||||||
internal.SetupPprof()
|
internal.SetupPprof()
|
||||||
|
|
||||||
|
logrus.Infof("Dendrite version %s", internal.VersionString())
|
||||||
|
|
||||||
closer, err := cfg.SetupTracing("Dendrite" + componentName)
|
closer, err := cfg.SetupTracing("Dendrite" + componentName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithError(err).Panicf("failed to start opentracing")
|
logrus.WithError(err).Panicf("failed to start opentracing")
|
||||||
|
|
26
internal/version.go
Normal file
26
internal/version.go
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package internal
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// -ldflags "-X github.com/matrix-org/dendrite/internal.branch=master"
|
||||||
|
var branch string
|
||||||
|
|
||||||
|
// -ldflags "-X github.com/matrix-org/dendrite/internal.build=alpha"
|
||||||
|
var build string
|
||||||
|
|
||||||
|
const (
|
||||||
|
VersionMajor = 0
|
||||||
|
VersionMinor = 0
|
||||||
|
VersionPatch = 0
|
||||||
|
)
|
||||||
|
|
||||||
|
func VersionString() string {
|
||||||
|
version := fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
|
||||||
|
if branch != "" {
|
||||||
|
version += fmt.Sprintf("-%s", branch)
|
||||||
|
}
|
||||||
|
if build != "" {
|
||||||
|
version += fmt.Sprintf("+%s", build)
|
||||||
|
}
|
||||||
|
return version
|
||||||
|
}
|
Loading…
Reference in a new issue