Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// S3Config specifies credentials and endpoint configuration. If not specified the middleware
// will load the default configuration with a background context.
//
// To provide a custom endpoint (required when not using AWS S3 API) you can do something like this
// (more info at https://aws.github.io/aws-sdk-go-v2/docs/configuring-sdk/endpoints/):
//
// resolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {
// if service == s3.ServiceID {
// return aws.Endpoint{
// URL: "http://localhost:9000",
// SigningRegion: "eu-central-1",
// HostnameImmutable: true,
// }, nil
// }
// // returning EndpointNotFoundError will allow the service to fallback to it's default resolution
// return aws.Endpoint{}, &aws.EndpointNotFoundError{}
// })
//
// s3cfg, err := config.LoadDefaultConfig(context.Background(), config.WithEndpointResolverWithOptions(resolver))
S3Config *aws.Config
// Bucket name of the bucket to use to store uploaded files
Bucket string
// BucketACL if CreateBucket is true the bucket will be created with this ACL (default: "private")
BucketACL string
// CreateBucket if true it will try to create a bucket with the specified Bucket name.
// Error of type BucketAlreadyOwnedByYou will be silently ignored (default: true)
CreateBucket bool
// FileACL defines ACL string to use for uploaded files (default: "private")
FileACL string
// PartSize defines the size of the chunk that is uploaded to S3, by default is 5 MB,
// which is the minimum part size. If a value smaller than the minimum is set, it
// will be silently adjusted to the minimum.
PartSize int64
// PrefixFunc defines a function that gets executed to define the S3 key prefix
// for each uploaded file. By default it's a function that returns the current date
// in the format `/YYYY/MM/DD/`
PrefixFunc func(*http.Request) string
// Logger is used to log errors during request processing (default: log.Default())
Logger Logger
}
Click to show internal directories.
Click to hide internal directories.