diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/setup/base.go | 2 | ||||
-rw-r--r-- | internal/version.go | 26 |
2 files changed, 28 insertions, 0 deletions
diff --git a/internal/setup/base.go b/internal/setup/base.go index 7bf06e74..ec2bbc4c 100644 --- a/internal/setup/base.go +++ b/internal/setup/base.go @@ -100,6 +100,8 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, useHTTPAPIs boo internal.SetupHookLogging(cfg.Logging, componentName) internal.SetupPprof() + logrus.Infof("Dendrite version %s", internal.VersionString()) + closer, err := cfg.SetupTracing("Dendrite" + componentName) if err != nil { logrus.WithError(err).Panicf("failed to start opentracing") diff --git a/internal/version.go b/internal/version.go new file mode 100644 index 00000000..851a0938 --- /dev/null +++ b/internal/version.go @@ -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 +} |