Add version/commit and -version

This commit is contained in:
Sam W 2023-05-04 23:11:13 +01:00
parent 71872e02d3
commit 8b1358c8d1
2 changed files with 15 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"flag"
"fmt"
"io"
"net/http"
"os"
@ -42,8 +43,17 @@ func main() {
debPath := flag.String("debpath", "debs", "Path to directory containing deb files.")
httpUser := flag.String("httpuser", "debanator", "Username for HTTP basic auth")
httpPass := flag.String("httppass", "", "Enable HTTP basic auth with this password")
showVersion := flag.Bool("version", false, "Show version")
flag.Parse()
log.Info("Starting...")
if *showVersion {
fmt.Printf("debanator %s, (git#%s)\n", debanator.Version, debanator.Commit)
os.Exit(0)
}
log.WithFields(log.Fields{
"version": debanator.Version,
"commit": debanator.Commit,
}).Info("Starting debanator...")
var ecKey *crypto.Key
kb, err := os.ReadFile("privkey.gpg")
if err != nil {

4
version.go Normal file
View File

@ -0,0 +1,4 @@
package debanator
const Version = "unknown"
const Commit = "unknown"