File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change 47
47
KO_DOCKER_REPO : ghcr.io/teifun2
48
48
TAGS : ${{ steps.meta.outputs.tags }}
49
49
LABELS : ${{ steps.meta.outputs.labels }}
50
+ VERSION : ${{ steps.meta.outputs.version }}
50
51
PLATFORMS : linux/amd64,linux/arm64,linux/arm
51
52
run : |
52
53
PTAGS=`echo $TAGS | sed 's/cs-unifi-bouncer://g'`
53
54
export SOURCE_DATE_EPOCH=$(date +%s)
55
+ export GOFLAGS="-ldflags=-X=main.version=$VERSION"
54
56
ko build -B --image-label "$LABELS" -t "$PTAGS" --platform=$PLATFORMS .
Original file line number Diff line number Diff line change @@ -28,7 +28,11 @@ type unifiAddrList struct {
28
28
modified bool
29
29
}
30
30
31
+ // This variable is set by the build process with ldflags
32
+ var version = "unknown"
33
+
31
34
func main () {
35
+ log .Info ().Msg ("Starting cs-unifi-bouncer with version: " + version )
32
36
33
37
// zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
34
38
initConfig ()
@@ -38,6 +42,7 @@ func main() {
38
42
APIUrl : crowdsecBouncerURL ,
39
43
TickerInterval : crowdsecUpdateInterval ,
40
44
Origins : crowdsecOrigins ,
45
+ UserAgent : fmt .Sprintf ("cs-unifi-bouncer/%s" , version ),
41
46
}
42
47
if err := bouncer .Init (); err != nil {
43
48
log .Fatal ().Err (err ).Msg ("Bouncer init failed" )
You can’t perform that action at this time.
0 commit comments