mirror of
https://github.com/pushbits/server.git
synced 2025-06-15 17:12:04 +02:00
Print version upon startup
This commit is contained in:
parent
1a31b91c18
commit
3a483526b6
2 changed files with 10 additions and 2 deletions
4
Makefile
4
Makefile
|
@ -5,12 +5,14 @@ DOCS_DIR := ./docs
|
|||
OUT_DIR := ./out
|
||||
TESTS_DIR := ./tests
|
||||
|
||||
VERSION := `git describe --tags`
|
||||
|
||||
SEMGREP_MODFILE := $(TESTS_DIR)/semgrep-rules/go.mod
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
mkdir -p $(OUT_DIR)
|
||||
go build -ldflags="-w -s" -o $(OUT_DIR)/pushbits ./cmd/pushbits
|
||||
go build -ldflags="-w -s -X main.Version=$(VERSION)" -o $(OUT_DIR)/pushbits ./cmd/pushbits
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
|
|
@ -14,6 +14,8 @@ import (
|
|||
"github.com/pushbits/server/internal/runner"
|
||||
)
|
||||
|
||||
var Version string
|
||||
|
||||
func setupCleanup(db *database.Database, dp *dispatcher.Dispatcher) {
|
||||
c := make(chan os.Signal)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
|
@ -42,7 +44,11 @@ func setupCleanup(db *database.Database, dp *dispatcher.Dispatcher) {
|
|||
|
||||
// @securityDefinitions.basic BasicAuth
|
||||
func main() {
|
||||
log.Println("Starting PushBits.")
|
||||
if len(Version) == 0 {
|
||||
log.Panic("Version not set")
|
||||
} else {
|
||||
log.Printf("Starting PushBits %s", Version)
|
||||
}
|
||||
|
||||
c := configuration.Get()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue