X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0eb72b526bf8bbb011551ecf019f604e17a534f1..5012102bb1854af9ae591c755feb2ea9c874b708:/services/keep-balance/main.go diff --git a/services/keep-balance/main.go b/services/keep-balance/main.go index 8a938ccf53..947033564d 100644 --- a/services/keep-balance/main.go +++ b/services/keep-balance/main.go @@ -7,6 +7,7 @@ package main import ( "encoding/json" "flag" + "fmt" "log" "os" "os/signal" @@ -17,6 +18,8 @@ import ( "git.curoverse.com/arvados.git/sdk/go/config" ) +var version = "dev" + const defaultConfigPath = "/etc/arvados/keep-balance/keep-balance.yml" // Config specifies site configuration, like API credentials and the @@ -85,9 +88,16 @@ func main() { dumpConfig := flag.Bool("dump-config", false, "write current configuration to stdout and exit") dumpFlag := flag.Bool("dump", false, "dump details for each block to stdout") debugFlag := flag.Bool("debug", false, "enable debug messages") + 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-balance %s\n", version) + return + } + mustReadConfig(&cfg, *configPath) if *serviceListPath != "" { mustReadConfig(&cfg.KeepServiceList, *serviceListPath) @@ -97,6 +107,8 @@ func main() { log.Fatal(config.DumpAndExit(cfg)) } + log.Printf("keep-balance %s started", version) + if *debugFlag { debugf = log.Printf if j, err := json.Marshal(cfg); err != nil {