Source File
awsenv.go
Belonging Package
go.pact.im/x/awsenv
// Package awsenv extends AWS SDK configuration with additional environment
// variables.
package awsenv
import (
)
// S3 returns additional options for s3.New and s3.NewFromConfig.
//
// Environment variables:
//
// AWS_S3_USE_PATH_STYLE, AWS_S3_FORCE_PATH_STYLE
// Sets s3.Options.UsePathStyle to true.
//
// AWS_S3_ENDPOINT
// Overrides AWS S3 endpoint (e.g. http://localhost:9000 for integration
// tests with MinIO).
//
func () []func( *s3.Options) {
return []func( *s3.Options){
func( *s3.Options) {
, := os.LookupEnv("AWS_S3_FORCE_PATH_STYLE")
, := os.LookupEnv("AWS_S3_USE_PATH_STYLE")
.UsePathStyle = ||
},
func( *s3.Options) {
, := os.LookupEnv("AWS_S3_ENDPOINT")
if ! {
return
}
.EndpointResolver = s3.EndpointResolverFromURL()
},
}
}
// S3Bucket returns S3 bucket name from environment.
//
// Environment variables:
//
// AWS_S3_BUCKET
// S3 bucket name to use.
//
func () string {
return os.Getenv("AWS_S3_BUCKET")
}
The pages are generated with Golds v0.4.9. (GOOS=linux GOARCH=amd64)