Skip to content

Commit

Permalink
create sse config when creating a minio client
Browse files Browse the repository at this point in the history
Signed-off-by: AvivGuiser <[email protected]>
  • Loading branch information
KyriosGN0 committed Aug 9, 2024
1 parent f8a3edf commit 441751c
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions tempodb/backend/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type readerWriter struct {
cfg *Config
core *minio.Core
hedgedCore *minio.Core
sse encrypt.ServerSide
}

var (
Expand Down Expand Up @@ -120,42 +121,35 @@ func internalNew(cfg *Config, confirm bool) (*readerWriter, error) {
}
}

encryption, err := buildSSEConfig(cfg)
if err != nil {
return nil, fmt.Errorf("returned Error when trying to configure Server Side Encryption: %w", err)
}

rw := &readerWriter{
logger: l,
cfg: cfg,
core: core,
hedgedCore: hedgedCore,
sse: encryption,
}

return rw, nil
}

func getPutObjectOptions(rw *readerWriter) minio.PutObjectOptions {
sseConfig, err := buildSSEConfig(rw.cfg)
if sseConfig == nil && err == nil {
return minio.PutObjectOptions{
PartSize: rw.cfg.PartSize,
UserTags: rw.cfg.Tags,
StorageClass: rw.cfg.StorageClass,
UserMetadata: rw.cfg.Metadata,
}
}
return minio.PutObjectOptions{
PartSize: rw.cfg.PartSize,
UserTags: rw.cfg.Tags,
StorageClass: rw.cfg.StorageClass,
UserMetadata: rw.cfg.Metadata,
ServerSideEncryption: sseConfig,
ServerSideEncryption: rw.sse,
}
}

func getObjectOptions(rw *readerWriter) minio.GetObjectOptions {
sseConfig, err := buildSSEConfig(rw.cfg)
if sseConfig == nil && err == nil {
return minio.GetObjectOptions{}
}
return minio.GetObjectOptions{
ServerSideEncryption: sseConfig,
ServerSideEncryption: rw.sse,
}
}

Expand Down

0 comments on commit 441751c

Please sign in to comment.