fix(bindings.s3): pathstyle logic and region
debug region Signed-off-by: Mike Nguyen <hey@mike.ee>
This commit is contained in:
parent
5f64a8f67b
commit
90b43f3adf
|
@ -136,15 +136,23 @@ func (s *AWSS3) Init(ctx context.Context, metadata bindings.Metadata) error {
|
|||
|
||||
var s3Options []func(options *s3.Options)
|
||||
|
||||
if s.metadata.Region != "" {
|
||||
s3Options = append(s3Options, func(options *s3.Options) {
|
||||
options.Region = s.metadata.Region
|
||||
})
|
||||
}
|
||||
|
||||
// TODO: Double check this config
|
||||
if s.metadata.DisableSSL {
|
||||
s3Options = append(s3Options, func(options *s3.Options) {
|
||||
options.EndpointOptions.DisableHTTPS = true
|
||||
})
|
||||
}
|
||||
|
||||
if !s.metadata.ForcePathStyle {
|
||||
if s.metadata.ForcePathStyle {
|
||||
s3Options = append(s3Options, func(options *s3.Options) {
|
||||
options.UsePathStyle = true
|
||||
options.EndpointOptions.ResolvedRegion = s.metadata.Region
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -174,6 +182,8 @@ func (s *AWSS3) Init(ctx context.Context, metadata bindings.Metadata) error {
|
|||
|
||||
s.s3PresignClient = s3.NewPresignClient(s.s3Client)
|
||||
|
||||
s.logger.Debugf("s3 binding: initialized with region %s", s.s3Client.Options().Region)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue