diff --git a/Dockerfile b/Dockerfile index 8f45dce..e5642c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,12 @@ RUN set -x \ && export GOGC=off \ && export CGO_ENABLED=0 \ && [ -d "./vendor" ] || go mod vendor \ - && go build -v -mod=vendor -trimpath -gcflags "all=-N -l" -ldflags "${LDFLAGS}" -o /go/bin/neofs-s3 ./cmd/gate \ + && go build \ + -v \ + -mod=vendor \ + -trimpath \ + -ldflags "${LDFLAGS} -X main.Build=$(date -u +%s%N) -X main.Prefix=S3_GW" \ + -o /go/bin/neofs-s3 ./cmd/gate \ && upx -3 /go/bin/neofs-s3 # Executable image diff --git a/cmd/gate/app-settings.go b/cmd/gate/app-settings.go index 72c90c6..ea578b2 100644 --- a/cmd/gate/app-settings.go +++ b/cmd/gate/app-settings.go @@ -40,6 +40,7 @@ const ( // settings cfgLoggerLevel = "logger.level" cfgLoggerFormat = "logger.format" cfgLoggerTraceLevel = "logger.trace_level" + cfgLoggerNoCaller = "logger.no_caller" cfgLoggerNoDisclaimer = "logger.no_disclaimer" cfgLoggerSamplingInitial = "logger.sampling.initial" cfgLoggerSamplingThereafter = "logger.sampling.thereafter" @@ -171,6 +172,7 @@ func newSettings() *viper.Viper { v.SetDefault(cfgLoggerLevel, "debug") v.SetDefault(cfgLoggerFormat, "console") v.SetDefault(cfgLoggerTraceLevel, "panic") + v.SetDefault(cfgLoggerNoCaller, false) v.SetDefault(cfgLoggerNoDisclaimer, true) v.SetDefault(cfgLoggerSamplingInitial, 1000) v.SetDefault(cfgLoggerSamplingThereafter, 1000) diff --git a/cmd/gate/main.go b/cmd/gate/main.go index ab0b183..7048af3 100644 --- a/cmd/gate/main.go +++ b/cmd/gate/main.go @@ -9,23 +9,23 @@ import ( func newLogger(v *viper.Viper) *zap.Logger { options := []logger.Option{ - logger.WithLevel(v.GetString("logger.level")), - logger.WithTraceLevel(v.GetString("logger.trace_level")), + logger.WithLevel(v.GetString(cfgLoggerLevel)), + logger.WithTraceLevel(v.GetString(cfgLoggerTraceLevel)), - logger.WithFormat(v.GetString("logger.format")), + logger.WithFormat(v.GetString(cfgLoggerFormat)), - logger.WithSamplingInitial(v.GetInt("logger.sampling.initial")), - logger.WithSamplingThereafter(v.GetInt("logger.sampling.thereafter")), + logger.WithSamplingInitial(v.GetInt(cfgLoggerSamplingInitial)), + logger.WithSamplingThereafter(v.GetInt(cfgLoggerSamplingThereafter)), - logger.WithAppName(v.GetString("app_name")), - logger.WithAppVersion(v.GetString("app_version")), + logger.WithAppName(v.GetString(cfgApplicationName)), + logger.WithAppVersion(v.GetString(cfgApplicationVersion)), } - if v.GetBool("logger.no_caller") { + if v.GetBool(cfgLoggerNoCaller) { options = append(options, logger.WithoutCaller()) } - if v.GetBool("logger.no_disclaimer") { + if v.GetBool(cfgLoggerNoDisclaimer) { options = append(options, logger.WithoutDisclaimer()) } diff --git a/misc/build.go b/misc/build.go index cb05cda..aedd352 100644 --- a/misc/build.go +++ b/misc/build.go @@ -1,12 +1,11 @@ package misc -const ( - Prefix = "S3" - - ApplicationName = "neofs-s3-gate" -) +const ApplicationName = "neofs-s3-gate" var ( + // TODO should be replaced with S3_GW before release + Prefix = "S3" + Build = "now" Version = "dev" )