10666: Replaced 'version' package with 'version' var
[arvados.git] / services / ws / main.go
index db33cbfd004173ff787f9767eddd06a448744d63..df462eafc2859e6d8aa071dbe851737cf3be2037 100644 (file)
@@ -7,21 +7,30 @@ package main
 import (
        "flag"
        "fmt"
+       "os"
 
        "git.curoverse.com/arvados.git/sdk/go/config"
        "git.curoverse.com/arvados.git/sdk/go/ctxlog"
 )
 
 var logger = ctxlog.FromContext
+var version = "dev"
 
 func main() {
        log := logger(nil)
 
        configPath := flag.String("config", "/etc/arvados/ws/ws.yml", "`path` to config file")
        dumpConfig := flag.Bool("dump-config", false, "show current configuration and exit")
+       getVersion := flag.Bool("version", false, "Print version information and exit.")
        cfg := defaultConfig()
        flag.Parse()
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", version)
+               os.Exit(0)
+       }
+
        err := config.LoadFile(&cfg, *configPath)
        if err != nil {
                log.Fatal(err)
@@ -39,6 +48,8 @@ func main() {
                return
        }
 
+       log.Printf("arvados-ws %q started", version)
+
        log.Info("started")
        srv := &server{wsConfig: &cfg}
        log.Fatal(srv.Run())