diff --git a/cmd/neofs-rest-gw/config.go b/cmd/neofs-rest-gw/config.go index e830ceb..86fc909 100644 --- a/cmd/neofs-rest-gw/config.go +++ b/cmd/neofs-rest-gw/config.go @@ -34,21 +34,23 @@ const ( defaultShutdownTimeout = 15 * time.Second - defaultPoolErrorThreshold uint32 = 100 + defaultPoolErrorThreshold uint32 = 100 + defaultPoolDefaultTimestamp bool = false // Pool config. - cmdNodeDialTimeout = "node-dial-timeout" - cfgNodeDialTimeout = "pool." + cmdNodeDialTimeout - cmdHealthcheckTimeout = "healthcheck-timeout" - cfgHealthcheckTimeout = "pool." + cmdHealthcheckTimeout - cmdRebalance = "rebalance-timer" - cfgRebalance = "pool." + cmdRebalance - cfgPoolErrorThreshold = "pool.error-threshold" - cmdPeers = "peers" - cfgPeers = "pool." + cmdPeers - cfgPeerAddress = "address" - cfgPeerPriority = "priority" - cfgPeerWeight = "weight" + cmdNodeDialTimeout = "node-dial-timeout" + cfgNodeDialTimeout = "pool." + cmdNodeDialTimeout + cmdHealthcheckTimeout = "healthcheck-timeout" + cfgHealthcheckTimeout = "pool." + cmdHealthcheckTimeout + cmdRebalance = "rebalance-timer" + cfgRebalance = "pool." + cmdRebalance + cfgPoolErrorThreshold = "pool.error-threshold" + cfgPoolDefaultTimestamp = "pool.default-timestamp" + cmdPeers = "peers" + cfgPeers = "pool." + cmdPeers + cfgPeerAddress = "address" + cfgPeerPriority = "priority" + cfgPeerWeight = "weight" // Metrics / Profiler. cfgPrometheusEnabled = "prometheus.enabled" @@ -153,6 +155,7 @@ func config() *viper.Viper { // set defaults: // pool v.SetDefault(cfgPoolErrorThreshold, defaultPoolErrorThreshold) + v.SetDefault(cfgPoolDefaultTimestamp, defaultPoolDefaultTimestamp) // metrics v.SetDefault(cfgPprofAddress, "localhost:8091") @@ -269,18 +272,19 @@ var bindings = map[string]string{ } var knownConfigParams = map[string]struct{}{ - cfgWalletAddress: {}, - cfgWalletPath: {}, - cfgWalletPassphrase: {}, - cfgRebalance: {}, - cfgHealthcheckTimeout: {}, - cfgNodeDialTimeout: {}, - cfgPoolErrorThreshold: {}, - cfgLoggerLevel: {}, - cfgPrometheusEnabled: {}, - cfgPrometheusAddress: {}, - cfgPprofEnabled: {}, - cfgPprofAddress: {}, + cfgWalletAddress: {}, + cfgWalletPath: {}, + cfgWalletPassphrase: {}, + cfgRebalance: {}, + cfgHealthcheckTimeout: {}, + cfgNodeDialTimeout: {}, + cfgPoolErrorThreshold: {}, + cfgPoolDefaultTimestamp: {}, + cfgLoggerLevel: {}, + cfgPrometheusEnabled: {}, + cfgPrometheusAddress: {}, + cfgPprofEnabled: {}, + cfgPprofAddress: {}, } func validateConfig(cfg *viper.Viper, logger *zap.Logger) { @@ -576,6 +580,8 @@ func newNeofsAPI(ctx context.Context, logger *zap.Logger, v *viper.Viper) (*hand apiPrm.ServiceShutdownTimeout = defaultShutdownTimeout apiPrm.MaxObjectSize = int64(ni.MaxObjectSize()) + apiPrm.DefaultTimestamp = v.GetBool(cfgPoolDefaultTimestamp) + return handlers.NewAPI(&apiPrm), nil } diff --git a/config/config.yaml b/config/config.yaml index b8c7f51..4334435 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -26,6 +26,8 @@ pool: rebalance-timer: 30s # The number of errors on connection after which node is considered as unhealthy. error-threshold: 100 + # By default, add a Timestamp to the object upon creation. + default-timestamp: false # Nodes configuration. # This configuration make gateway use the first node (grpc://s01.neofs.devenv:8080) diff --git a/docs/gate-configuration.md b/docs/gate-configuration.md index 6a5204f..8f0dc0c 100644 --- a/docs/gate-configuration.md +++ b/docs/gate-configuration.md @@ -107,6 +107,7 @@ pool: | `healthcheck-timeout` | `duration` | `15s` | Timeout to check node health during rebalance. | | `rebalance-timer` | `duration` | `60s` | Interval to check node health. | | `error-threshold` | `uint32` | `100` | The number of errors on connection after which node is considered as unhealthy. | +| `default-timestamp` | `bool` | `false` | By default, add a Timestamp to the object upon creation. | | ## `peers` section