a gin handler to fetch files from s3
Download and install it:
$ go get github.com/tjamet/gin-s3
Import it in your code:
import "github.com/tjamet/gin-s3"
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()
}
func main() {
router := gin.Default()
router.Use(ginS3.NewDefault(
"test-bucket",
ginS3.AddProvider(
&credentials.StaticProvider{
Value: credentials.Value{
AccessKeyID: "EXAMPLE",
SecretAccessKey: "EXAMPLEKEY",
},
})
)
)
router.Run()
}