From 424fb7a1d1d9d9a35d8ed4ee14a0fbffa87fe10d Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 19 Oct 2020 04:05:28 +0300 Subject: [PATCH] [#25] Migrate cmd/gate to NeoFS API v2 Naive migration, without any tries to start application closes #25 Signed-off-by: Evgeniy Kulikov --- cmd/gate/app.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cmd/gate/app.go b/cmd/gate/app.go index baf2cddf2..de24a7c30 100644 --- a/cmd/gate/app.go +++ b/cmd/gate/app.go @@ -3,8 +3,10 @@ package main import ( "context" "crypto/ecdsa" + "errors" "net" "net/http" + "os" "time" "github.com/nspcc-dev/neofs-authmate/accessbox/hcs" @@ -148,12 +150,24 @@ func newApp(ctx context.Context, l *zap.Logger, v *viper.Viper) *App { cli.ReBalance(ctx) if _, err = cli.Connection(ctx); err != nil { + if errors.Is(err, context.Canceled) { + l.Info("connection canceled") + os.Exit(0) + } + l.Fatal("could not establish connection", zap.Error(err)) } } - if obj, err = layer.NewLayer(l, cli, nfKey); err != nil { + layerParams := &layer.Params{ + Pool: cli, + Logger: l, + Timeout: reqTimeout, + NFKey: nfKey, + } + + if obj, err = layer.NewLayer(layerParams); err != nil { l.Fatal("could not prepare ObjectLayer", zap.Error(err)) }