Skip to content

Commit

Permalink
feat: add flag -version
Browse files Browse the repository at this point in the history
  • Loading branch information
janfuhrer committed Dec 28, 2024
1 parent e2c1cc6 commit 7a7dbd2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ var (
"Address on which to expose metrics")
loglevel = flag.String("pbs.loglevel", "info",
"Loglevel")
showVersion = flag.Bool("version", false, "Show version and exit")

// Metrics
up = prometheus.NewDesc(
Expand Down Expand Up @@ -756,6 +757,11 @@ func findLastSnapshotWithBackupID(response SnapshotResponse, backupID string) (i
func main() {
flag.Parse()

if *showVersion {
fmt.Printf("PBS Exporter Version: %s, Commit: %s, Build Time: %s\n", Version, Commit, BuildTime)
os.Exit(0)
}

// log build information
log.Printf("INFO: Starting PBS Exporter %s, commit %s, built at %s", Version, Commit, BuildTime)

Expand Down

0 comments on commit 7a7dbd2

Please sign in to comment.