frostfs-http-gw/main.go
Angira Kekteeva 82b2126bfd [#46] *: Remove moved to sdk packages, refactoring
Removed connections, logger, neofs because they were moved to sdk repo.
Made changes in downloader, uploader, main.go and app.go via
refactoring of neofs.
Replaced dependencies to removed packages by sdk packages.

Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
2021-05-28 14:45:46 +03:00

45 lines
1.2 KiB
Go

package main
import (
"context"
"os/signal"
"syscall"
"github.com/nspcc-dev/neofs-sdk-go/pkg/logger"
"github.com/spf13/viper"
"go.uber.org/zap"
)
func main() {
var (
v = settings()
l = newLogger(v)
)
globalContext, _ := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
app := newApp(globalContext, WithLogger(l), WithConfig(v))
go app.Serve(globalContext)
app.Wait()
}
func newLogger(v *viper.Viper) *zap.Logger {
options := []logger.Option{
logger.WithLevel(v.GetString(cfgLoggerLevel)),
logger.WithTraceLevel(v.GetString(cfgLoggerTraceLevel)),
logger.WithFormat(v.GetString(cfgLoggerFormat)),
logger.WithSamplingInitial(v.GetInt(cfgLoggerSamplingInitial)),
logger.WithSamplingThereafter(v.GetInt(cfgLoggerSamplingThereafter)),
logger.WithAppName(v.GetString(cfgApplicationName)),
logger.WithAppVersion(v.GetString(cfgApplicationVersion)),
}
if v.GetBool(cfgLoggerNoCaller) {
options = append(options, logger.WithoutCaller())
}
if v.GetBool(cfgLoggerNoDisclaimer) {
options = append(options, logger.WithoutDisclaimer())
}
l, err := logger.New(options...)
if err != nil {
panic(err)
}
return l
}