forked from TrueCloudLab/frostfs-node
[#667] node: Add --version
flag support
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
eadc3a4de9
commit
75632a7d83
1 changed files with 18 additions and 0 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
|
@ -13,6 +14,11 @@ import (
|
|||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
const (
|
||||
// SuccessReturnCode returns when application closed without panic
|
||||
SuccessReturnCode = 0
|
||||
)
|
||||
|
||||
// prints err to standard logger and calls os.Exit(1).
|
||||
func fatalOnErr(err error) {
|
||||
if err != nil {
|
||||
|
@ -29,8 +35,20 @@ func fatalOnErrDetails(details string, err error) {
|
|||
|
||||
func main() {
|
||||
configFile := flag.String("config", "", "path to config")
|
||||
versionFlag := flag.Bool("version", false, "neofs-ir node version")
|
||||
flag.Parse()
|
||||
|
||||
if *versionFlag {
|
||||
fmt.Printf(
|
||||
"Version: %s \nBuild: %s \nDebug: %s\n",
|
||||
misc.Version,
|
||||
misc.Build,
|
||||
misc.Debug,
|
||||
)
|
||||
|
||||
os.Exit(SuccessReturnCode)
|
||||
}
|
||||
|
||||
c := initCfg(*configFile)
|
||||
|
||||
initApp(c)
|
||||
|
|
Loading…
Reference in a new issue