Skip to content

Commit

Permalink
build(deps): bump all dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
  • Loading branch information
jkroepke committed Aug 1, 2024
1 parent 019a9f5 commit 9efcf14
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 34 deletions.
32 changes: 24 additions & 8 deletions pkg/cli/server/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,16 +668,32 @@ func applyDefaultValues(config *config.Config, viperInstance *viper.Viper, log z
config.Storage.RemoteCache = true
}

// s3 dedup=false, check for previous dedupe usage and set to true if cachedb found
if !config.Storage.Dedupe && config.Storage.StorageDriver != nil {
cacheDir, _ := config.Storage.StorageDriver["rootdirectory"].(string)
cachePath := path.Join(cacheDir, storageConstants.BoltdbName+storageConstants.DBExtensionName)
if config.Storage.StorageDriver != nil {
// s3 dedup=false, check for previous dedupe usage and set to true if cachedb found
if !config.Storage.Dedupe {
cacheDir, _ := config.Storage.StorageDriver["rootdirectory"].(string)
cachePath := path.Join(cacheDir, storageConstants.BoltdbName+storageConstants.DBExtensionName)

if _, err := os.Stat(cachePath); err == nil {
log.Info().Str("component", "config").Msg("dedupe set to false for s3 driver but used to be true.")
log.Info().Str("cache path", cachePath).Msg("found cache database")
if _, err := os.Stat(cachePath); err == nil {
log.Info().Str("component", "config").Msg("dedupe set to false for s3 driver but used to be true.")
log.Info().Str("cache path", cachePath).Msg("found cache database")

config.Storage.RemoteCache = false
config.Storage.RemoteCache = false
}
}

// backward compatibility for s3 storage driver
// if regionendpoint is provided, forcepathstyle should be set to true
// ref: https://github.com/distribution/distribution/pull/4291
if config.Storage.StorageDriver["name"] == storageConstants.S3StorageDriverName {
_, hasRegionEndpoint := config.Storage.StorageDriver["regionendpoint"]
_, hasForcePathStyle := config.Storage.StorageDriver["forcepathstyle"]

if hasRegionEndpoint && !hasForcePathStyle {
log.Warn().
Msg("DEPRECATED: automatically setting forcepathstyle to true for s3 storage driver.") //nolint: check-logs
config.Storage.StorageDriver["forcepathstyle"] = true
}
}
}

Expand Down
28 changes: 2 additions & 26 deletions pkg/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,7 @@ func New(config *config.Config, linter common.Lint, metrics monitoring.MetricSer
)
} else {
storeName := fmt.Sprintf("%v", config.Storage.StorageDriver["name"])
switch storeName {
case constants.S3StorageDriverName:
// backward compatibility for s3 storage driver
// if regionendpoint is provided, forcepathstyle should be set to true
// ref: https://github.com/distribution/distribution/pull/4291
if _, ok := config.Storage.StorageDriver["regionendpoint"]; ok {
if _, ok = config.Storage.StorageDriver["forcepathstyle"]; !ok {
log.Warn().
Msg("DEPRECATED: automatically setting forcepathstyle to true for s3 storage driver.") //nolint: check-logs
config.Storage.StorageDriver["forcepathstyle"] = true
}
}
default:
if storeName != constants.S3StorageDriverName {
log.Error().Err(zerr.ErrBadConfig).Str("storageDriver", storeName).
Msg("unsupported storage driver")

Expand Down Expand Up @@ -189,19 +177,7 @@ func getSubStore(cfg *config.Config, subPaths map[string]config.StorageConfig,
}
} else {
storeName := fmt.Sprintf("%v", storageConfig.StorageDriver["name"])
switch storeName {
case constants.S3StorageDriverName:
// backward compatibility for s3 storage driver
// if regionendpoint is provided, forcepathstyle should be set to true
// ref: https://github.com/distribution/distribution/pull/4291
if _, ok := storageConfig.StorageDriver["regionendpoint"]; ok {
if _, ok = storageConfig.StorageDriver["forcepathstyle"]; !ok {
log.Warn().
Msg("DEPRECATED: automatically setting forcepathstyle to true for s3 storage driver.") //nolint: check-logs
storageConfig.StorageDriver["forcepathstyle"] = true
}
}
default:
if storeName != constants.S3StorageDriverName {
log.Error().Err(zerr.ErrBadConfig).Str("storageDriver", storeName).
Msg("unsupported storage driver")

Expand Down

0 comments on commit 9efcf14

Please sign in to comment.