Skip to content

Latest commit

 

History

History
64 lines (49 loc) · 1.36 KB

README.md

File metadata and controls

64 lines (49 loc) · 1.36 KB

gin-s3

Build Status codecov Go Report Card GoDoc

a gin handler to fetch files from s3

Usage

Start using it

Download and install it:

$ go get github.com/tjamet/gin-s3

Import it in your code:

import "github.com/tjamet/gin-s3"

Canonical example:

package main

import (
	"time"

	"github.com/tjamet/gin-s3"
	"github.com/gin-gonic/gin"
)

func main() {
	router := gin.Default()
	// Gets credentials from the environment, the config files or the amazon instance
	router.Use(ginS3.NewDefault("test-bucket"))
	router.Run()
}

Using Specific access keys

func main() {
	router := gin.Default()
	router.Use(ginS3.NewDefault(
        "test-bucket",
        ginS3.AddProvider(
            &credentials.StaticProvider{
                Value: credentials.Value{
                    AccessKeyID:     "EXAMPLE",
                    SecretAccessKey: "EXAMPLEKEY",
                },
            })
        )
    )
	router.Run()
}