Skip to content

Commit

Permalink
Log version string on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
rkojedzinszky committed Jan 26, 2021
1 parent 1920afb commit f6ba082
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .drone.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ steps:
- name: build
image: golang:1.15-alpine3.12
commands:
- CGO_ENABLED=0 go build .
- apk --no-cache add binutils
- strip -s postfix-ratelimiter
- apk --no-cache add make git
- git fetch --tags
- CGO_ENABLED=0 make

- name: docker
image: plugins/docker:19
Expand Down
6 changes: 3 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: pipeline
name: build-arm64
platform: {arch: arm64, os: linux, variant: v8}
steps:
- commands: [CGO_ENABLED=0 go build ., apk --no-cache add binutils, strip -s postfix-ratelimiter]
- commands: [apk --no-cache add make git, git fetch --tags, CGO_ENABLED=0 make]
image: golang:1.15-alpine3.12
name: build
- image: plugins/docker:19
Expand All @@ -23,7 +23,7 @@ kind: pipeline
name: build-arm
platform: {arch: arm, os: linux, variant: v7}
steps:
- commands: [CGO_ENABLED=0 go build ., apk --no-cache add binutils, strip -s postfix-ratelimiter]
- commands: [apk --no-cache add make git, git fetch --tags, CGO_ENABLED=0 make]
image: golang:1.15-alpine3.12
name: build
- image: plugins/docker:19
Expand All @@ -42,7 +42,7 @@ kind: pipeline
name: build-amd64
platform: {arch: amd64, os: linux}
steps:
- commands: [CGO_ENABLED=0 go build ., apk --no-cache add binutils, strip -s postfix-ratelimiter]
- commands: [apk --no-cache add make git, git fetch --tags, CGO_ENABLED=0 make]
image: golang:1.15-alpine3.12
name: build
- image: plugins/docker:19
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
all: postfix-ratelimiter

VERSION = $(shell git describe --tags)

GO = go

postfix-ratelimiter:
$(GO) build -ldflags "-s -X main.version=$(VERSION)" .

clean:
rm -f postfix-ratelimiter
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
"github.com/rkojedzinszky/postfix-sasl-exporter/server"
)

var version = "devel"

func main() {
defaultrate := flag.Float64("default-rate", 1, "Default rate for policing (recipient/seconds)")
defaultburst := flag.Float64("default-burst", 60, "Default burst for policing")
Expand Down Expand Up @@ -61,6 +63,8 @@ func main() {
users: make(map[string]*tbf),
}

log.Printf("postfix-ratelimiter version %s starting", version)

ctx, cancel := context.WithCancel(context.Background())
wg := &sync.WaitGroup{}

Expand Down

0 comments on commit f6ba082

Please sign in to comment.