mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 03:56:37 +00:00
Added -version flag to watchdog
This changes introduces a new flag -version to watchdog which will display version and SHA of last git commit. Version and SHA are injected at build time and passed as a build-args for Dockerfile. Fixes: #632 Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
This commit is contained in:
@ -6,6 +6,7 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
@ -309,7 +310,12 @@ func makeRequestHandler(config *WatchdogConfig) func(http.ResponseWriter, *http.
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
version = flag.Bool("version", false, "Print the version and Git SHA")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
acceptingConnections = false
|
||||
|
||||
osEnv := types.OsEnv{}
|
||||
@ -321,6 +327,12 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
if *version == true {
|
||||
fmt.Printf("Commit: %v\n", GitCommit)
|
||||
fmt.Printf("Version: %v\n", BuildVersion())
|
||||
return
|
||||
}
|
||||
|
||||
readTimeout := config.readTimeout
|
||||
writeTimeout := config.writeTimeout
|
||||
|
||||
|
Reference in New Issue
Block a user