[#25] Migrate cmd/gate to NeoFS API v2

Naive migration, without any tries to start application

closes #25

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
remotes/KirillovDenis/bugfix/681-fix_acl_parsing
Evgeniy Kulikov 2020-10-19 04:05:28 +03:00
parent b72a957341
commit 424fb7a1d1
1 changed files with 15 additions and 1 deletions

View File

@ -3,8 +3,10 @@ package main
import ( import (
"context" "context"
"crypto/ecdsa" "crypto/ecdsa"
"errors"
"net" "net"
"net/http" "net/http"
"os"
"time" "time"
"github.com/nspcc-dev/neofs-authmate/accessbox/hcs" "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) cli.ReBalance(ctx)
if _, err = cli.Connection(ctx); err != nil { 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", l.Fatal("could not establish connection",
zap.Error(err)) 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)) l.Fatal("could not prepare ObjectLayer", zap.Error(err))
} }