diff --git a/cmd/authmate/main.go b/cmd/authmate/main.go index af0a526..5317b0e 100644 --- a/cmd/authmate/main.go +++ b/cmd/authmate/main.go @@ -6,12 +6,13 @@ import ( "encoding/json" "fmt" "os" + "os/signal" + "syscall" "time" sdk "github.com/nspcc-dev/cdn-sdk" "github.com/nspcc-dev/cdn-sdk/creds/hcs" "github.com/nspcc-dev/cdn-sdk/creds/neofs" - "github.com/nspcc-dev/cdn-sdk/grace" "github.com/nspcc-dev/cdn-sdk/pool" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-s3-gw/authmate" @@ -64,12 +65,13 @@ var zapConfig = zap.Config{ func prepare() (context.Context, *zap.Logger) { var ( - err error - log = zap.NewNop() + err error + log = zap.NewNop() + ctx, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP) ) if !logEnabledFlag { - return grace.Context(log), log + return ctx, log } else if logDebugEnabledFlag { zapConfig.Level = zap.NewAtomicLevelAt(zapcore.DebugLevel) } @@ -78,7 +80,7 @@ func prepare() (context.Context, *zap.Logger) { panic(err) } - return grace.Context(log), log + return ctx, log } func main() { diff --git a/cmd/s3-gw/main.go b/cmd/s3-gw/main.go index 7caede8..35f6ff3 100644 --- a/cmd/s3-gw/main.go +++ b/cmd/s3-gw/main.go @@ -1,7 +1,10 @@ package main import ( - "github.com/nspcc-dev/cdn-sdk/grace" + "context" + "os/signal" + "syscall" + "github.com/nspcc-dev/cdn-sdk/logger" "github.com/spf13/viper" "go.uber.org/zap" @@ -39,10 +42,10 @@ func newLogger(v *viper.Viper) *zap.Logger { func main() { var ( - v = newSettings() - l = newLogger(v) - g = grace.Context(l) - a = newApp(g, l, v) + v = newSettings() + l = newLogger(v) + g, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP) + a = newApp(g, l, v) ) go a.Server(g) diff --git a/go.mod b/go.mod index d163875..8002da2 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/nspcc-dev/neofs-s3-gw -go 1.14 +go 1.16 require ( github.com/aws/aws-sdk-go v1.37.9 @@ -8,6 +8,7 @@ require ( github.com/gorilla/mux v1.8.0 github.com/nspcc-dev/cdn-sdk v0.3.4 github.com/nspcc-dev/neofs-api-go v1.23.0 + github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/neofs-node v1.22.0 github.com/prometheus/client_golang v1.9.0 github.com/spf13/pflag v1.0.5 @@ -15,5 +16,6 @@ require ( github.com/stretchr/testify v1.7.0 github.com/urfave/cli/v2 v2.3.0 go.uber.org/zap v1.16.0 + golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 google.golang.org/grpc v1.35.0 )