From 17f09de1e86e1759a0c6c46000953d7e3389be68 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Sun, 13 May 2018 14:22:03 -0300 Subject: [PATCH] feat: also support minio --- .goreleaser.yml | 1 + config/config.go | 7 ++++--- pipeline/s3/s3.go | 7 ++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 01e2a4487..6cf284ffb 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -81,4 +81,5 @@ snapcraft: confinement: classic s3: - bucket: goreleaser + endpoint: http://localhost:9000 diff --git a/config/config.go b/config/config.go index 1bc998956..bcc6ff60e 100644 --- a/config/config.go +++ b/config/config.go @@ -246,9 +246,10 @@ type Before struct { // S3 contains s3 config type S3 struct { - Region string - Bucket string - Folder string + Region string + Bucket string + Folder string + Endpoint string // used for minio for example } // Project includes all project configuration diff --git a/pipeline/s3/s3.go b/pipeline/s3/s3.go index c06579881..a1f755a6d 100644 --- a/pipeline/s3/s3.go +++ b/pipeline/s3/s3.go @@ -56,7 +56,12 @@ func (Pipe) Run(ctx *context.Context) error { } func upload(ctx *context.Context, conf config.S3) error { - sess := session.Must(session.NewSession()) + var awsConfig = aws.Config{} + if conf.Endpoint != "" { + awsConfig.Endpoint = aws.String(conf.Endpoint) + awsConfig.S3ForcePathStyle = aws.Bool(true) + } + sess := session.Must(session.NewSession(&awsConfig)) svc := s3.New(sess, &aws.Config{ Region: aws.String(conf.Region), })