Initial config for S3/etc
continuous-integration/drone/push Build is failing

This commit is contained in:
Tyler
2020-06-14 04:49:48 -04:00
parent 09549b0178
commit 3a1ac5fcf5
4 changed files with 57 additions and 2 deletions
+29 -2
View File
@@ -4,6 +4,10 @@ import (
"errors"
"flag"
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
s3 "github.com/fclairamb/afero-s3"
"github.com/go-ini/ini"
"github.com/spf13/afero"
"golang.org/x/crypto/openpgp"
@@ -18,7 +22,7 @@ import (
"sync"
)
var VERSION = "1.4.0"
var VERSION = "1.4.1"
func packageName(name string) string {
if index := strings.Index(name, "_"); index != -1 {
@@ -71,7 +75,30 @@ func main() {
}
}
fs = afero.NewBasePathFs(afero.NewOsFs(), conf.Repo.Root)
switch conf.Fs.Driver {
case "s3":
awsConfig := &aws.Config{
Region: aws.String(conf.Fs.S3.Region),
Credentials: credentials.NewStaticCredentials(conf.Fs.S3.ID, conf.Fs.S3.Secret, ""),
}
if conf.Fs.S3.Endpoint != "" {
awsConfig.Endpoint = aws.String(conf.Fs.S3.Endpoint)
}
sess, err := session.NewSession(awsConfig)
if err != nil {
log.Fatalln("Unable to create S3 session:", err)
}
fs = s3.NewFs(conf.Fs.S3.Bucket, sess)
case "local":
fallthrough
default:
fs = afero.NewBasePathFs(afero.NewOsFs(), conf.Repo.Root)
}
if err := createDirs(conf); err != nil {
log.Println(err)