VOL-1674 - add version reporting information
Change-Id: Ie6cc244c66077467d371ffb3506ea0f4e817c197
diff --git a/afrouter/afrouter/config.go b/afrouter/afrouter/config.go
index 044fdd7..1f0be7b 100644
--- a/afrouter/afrouter/config.go
+++ b/afrouter/afrouter/config.go
@@ -34,6 +34,7 @@
config.ConfigFile = cmdParse.String("config", "arouter.json", "The configuration file for the affinity router")
config.LogLevel = cmdParse.Int("logLevel", 0, "The log level for the affinity router")
config.GrpcLog = cmdParse.Bool("grpclog", false, "Enable GRPC logging")
+ config.DisplayVersionOnly = cmdParse.Bool("version", false, "Print version information and exit")
err := cmdParse.Parse(os.Args[1:])
if err != nil {
@@ -50,6 +51,7 @@
ConfigFile *string
LogLevel *int
GrpcLog *bool
+ DisplayVersionOnly *bool
Servers []ServerConfig `json:"servers"`
Ports PortConfig `json:"ports"`
ServerCertificates ServerCertConfig `json:"serverCertificates"`
diff --git a/afrouter/arouter.go b/afrouter/arouter.go
index 4342f68..10ee873 100644
--- a/afrouter/arouter.go
+++ b/afrouter/arouter.go
@@ -20,6 +20,7 @@
"fmt"
"github.com/opencord/voltha-go/afrouter/afrouter"
"github.com/opencord/voltha-go/common/log"
+ "github.com/opencord/voltha-go/common/version"
"google.golang.org/grpc/grpclog"
slog "log"
"os"
@@ -40,6 +41,12 @@
defer log.CleanUp()
+ if *conf.DisplayVersionOnly {
+ fmt.Println("VOLTHA API Server (afrouter)")
+ fmt.Println(version.VersionInfo.String(" "))
+ return
+ }
+
// Parse the config file
err = conf.LoadConfig()
if err != nil {