1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-06-19 05:10:02 +02:00

src/main.go: add -v and --version flag.

This commit is contained in:
Henrik Hautakoski 2021-12-02 12:56:09 +01:00
parent de78a7c622
commit 15a4566b3b

View file

@ -51,13 +51,20 @@ func openlog(file string) *os.File {
// ---------------------------------------------------------
func main() {
var version bool
var logfd *os.File
// Command line parsing
getopt.FlagLong(&version, "version", 'v', "Print version")
getopt.FlagLong(&logFile, "log", 'l', "Path to log file", "file")
getopt.FlagLong(&pidFile, "pid", 'p', "Path to pid file", "file")
getopt.Parse()
if version {
print("Version: v1.0\n")
return;
}
if len(logFile) > 0 {
logfd = openlog(logFile)
log.SetWriter(logfd)