From f143bcf3329a6f3dba8f1e55dad6afa97e884011 Mon Sep 17 00:00:00 2001 From: Larry Ruane Date: Thu, 7 Nov 2019 16:20:45 -0700 Subject: [PATCH] add -version argument to ingest and server executables, v0.1.0 --- cmd/ingest/main.go | 6 ++++++ cmd/server/main.go | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/cmd/ingest/main.go b/cmd/ingest/main.go index 70440e4..2a065de 100644 --- a/cmd/ingest/main.go +++ b/cmd/ingest/main.go @@ -31,6 +31,7 @@ type Options struct { logLevel uint64 logPath string zcashConfPath string + wantVersion bool } func main() { @@ -39,10 +40,15 @@ func main() { flag.Uint64Var(&opts.logLevel, "log-level", uint64(logrus.InfoLevel), "log level (logrus 1-7)") flag.StringVar(&opts.logPath, "log-file", "", "log file to write to") flag.StringVar(&opts.zcashConfPath, "conf-file", "", "conf file to pull RPC creds from") + flag.BoolVar(&opts.wantVersion, "version", false, "version (major.minor.patch)") // TODO prod metrics // TODO support config from file and env vars flag.Parse() + if opts.wantVersion { + fmt.Println("lightwalletd ingest version v0.1.0") + return + } if opts.dbPath == "" { flag.Usage() os.Exit(1) diff --git a/cmd/server/main.go b/cmd/server/main.go index bff919e..0a596e3 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -90,6 +90,7 @@ type Options struct { logPath string `json:"log_file,omitempty"` zcashConfPath string `json:"zcash_conf,omitempty"` veryInsecure bool `json:"very_insecure,omitempty"` + wantVersion bool } func fileExists(filename string) bool { @@ -110,10 +111,16 @@ func main() { flag.StringVar(&opts.logPath, "log-file", "./server.log", "log file to write to") flag.StringVar(&opts.zcashConfPath, "conf-file", "./zcash.conf", "conf file to pull RPC creds from") flag.BoolVar(&opts.veryInsecure, "very-insecure", false, "run without the required TLS certificate, only for debugging, DO NOT use in production") + flag.BoolVar(&opts.wantVersion, "version", false, "version (major.minor.patch)") // TODO prod metrics // TODO support config from file and env vars flag.Parse() + if opts.wantVersion { + fmt.Println("lightwalletd ingest version v0.1.0") + return + } + filesThatShouldExist := []string{ opts.dbPath, opts.tlsCertPath,