storages

Collection of key-value storages adapters for Golang

This project is maintained by reddec

S3

API docs

Wrapper around official S3 SDK to work with bucket as a map.

Support AWS or any other S3 capable services like Minio.

URL initialization

Do not forget to import package!

s3://[address:port]/<bucket>[?force-path=true]

Where:

Other parameters will be loaded from environment (see below)

Example:

Usage

Common properties for configuration from environment variables.

Requires import github.com/aws/aws-sdk-go/aws

AWS S3

config := aws.NewConfig()
config.Credentials = credentials.NewEnvCredentials()
stor, err := awsstorage.New("bucket-name", config)
if err != nil {
    panic(err)
}
defer stor.Close()

Minio

config := config.WithEndpoint("minio-endpoint-addr")
config.S3ForcePathStyle = true
config.Credentials = credentials.NewEnvCredentials()
stor, err := awsstorage.New("bucket-name", config)
if err != nil {
    panic(err)
}
defer stor.Close()