Skip to content

Commit

Permalink
Merge pull request #1 from natrontech/feat/version
Browse files Browse the repository at this point in the history
feat: add flag -version
  • Loading branch information
janfuhrer authored Dec 28, 2024
2 parents 6b03094 + 2d40f0a commit 582e3e2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"fmt"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -31,9 +32,15 @@ func main() {
"Loglevel")
ignoreIndividuals = flag.String("openvpn.ignore-individuals", "false",
"If ignoring metrics for individuals")
showVersion = flag.Bool("version", false, "Show version and exit")
)
flag.Parse()

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

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

Expand Down

0 comments on commit 582e3e2

Please sign in to comment.