[#578] Unify version output

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-07-13 15:27:05 +03:00 committed by Alex Vanin
parent aad4862c59
commit f5441eb6cb
2 changed files with 7 additions and 2 deletions

View file

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"os" "os"
"os/signal" "os/signal"
"runtime"
"strings" "strings"
"syscall" "syscall"
"time" "time"
@ -109,12 +110,15 @@ func prepare() (context.Context, *zap.Logger) {
func main() { func main() {
app := &cli.App{ app := &cli.App{
Name: "NeoFS gate authentication manager", Name: "NeoFS S3 Authmate",
Usage: "Helps manage delegated access via gates to data stored in NeoFS network", Usage: "Helps manage delegated access via gates to data stored in NeoFS network",
Version: version.Version, Version: version.Version,
Flags: appFlags(), Flags: appFlags(),
Commands: appCommands(), Commands: appCommands(),
} }
cli.VersionPrinter = func(c *cli.Context) {
fmt.Printf("%s\nVersion: %s\nGoVersion: %s\n", c.App.Name, c.App.Version, runtime.Version())
}
viper.AutomaticEnv() viper.AutomaticEnv()
viper.SetEnvPrefix("AUTHMATE") viper.SetEnvPrefix("AUTHMATE")

View file

@ -3,6 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"os" "os"
"runtime"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
@ -259,7 +260,7 @@ func newSettings() *viper.Viper {
os.Exit(0) os.Exit(0)
case versionFlag != nil && *versionFlag: case versionFlag != nil && *versionFlag:
fmt.Printf("NeoFS S3 gateway %s\n", version.Version) fmt.Printf("NeoFS S3 Gateway\nVersion: %s\nGoVersion: %s\n", version.Version, runtime.Version())
os.Exit(0) os.Exit(0)
} }