10666: Formatting fixes.
[arvados.git] / services / keep-web / main.go
index 27ceb48c78bfebbc40aa9d3732cbcbba6ad63155..724af27c7e0e746b44218f5269d23b71228e6655 100644 (file)
@@ -6,6 +6,7 @@ package main
 
 import (
        "flag"
+       "fmt"
        "log"
        "os"
        "time"
@@ -17,6 +18,7 @@ import (
 
 var (
        defaultConfigPath = "/etc/arvados/keep-web/keep-web.yml"
+       version           = "dev"
 )
 
 // Config specifies server configuration.
@@ -85,9 +87,17 @@ func main() {
 
        dumpConfig := flag.Bool("dump-config", false,
                "write current configuration to stdout and exit")
+       getVersion := flag.Bool("version", false,
+               "print version information and exit.")
        flag.Usage = usage
        flag.Parse()
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("keep-web %s\n", version)
+               return
+       }
+
        if err := config.LoadFile(cfg, configPath); err != nil {
                if h := os.Getenv("ARVADOS_API_HOST"); h != "" && configPath == defaultConfigPath {
                        log.Printf("DEPRECATED: Using ARVADOS_API_HOST environment variable. Use config file instead.")
@@ -105,6 +115,8 @@ func main() {
                log.Fatal(config.DumpAndExit(cfg))
        }
 
+       log.Printf("keep-web %s started", version)
+
        os.Setenv("ARVADOS_API_HOST", cfg.Client.APIHost)
        srv := &server{Config: cfg}
        if err := srv.Start(); err != nil {