mirror of
https://github.com/thegeeklab/wp-s3-action.git
synced 2024-11-28 09:20:36 +00:00
Endpoint for aws.Config is optional
This commit is contained in:
parent
5001f2ffa0
commit
be22fc0596
14
aws.go
14
aws.go
@ -28,13 +28,19 @@ type AWS struct {
|
||||
}
|
||||
|
||||
func NewAWS(p *Plugin) AWS {
|
||||
sess := session.New(&aws.Config{
|
||||
Endpoint: &p.Endpoint,
|
||||
DisableSSL: aws.Bool(strings.HasPrefix(p.Endpoint, "http://")),
|
||||
sessCfg := &aws.Config{
|
||||
Credentials: credentials.NewStaticCredentials(p.Key, p.Secret, ""),
|
||||
S3ForcePathStyle: aws.Bool(p.PathStyle),
|
||||
Region: aws.String(p.Region),
|
||||
})
|
||||
}
|
||||
|
||||
fmt.Println(p.Endpoint)
|
||||
if p.Endpoint != "" {
|
||||
sessCfg.Endpoint = &p.Endpoint
|
||||
sessCfg.DisableSSL = aws.Bool(strings.HasPrefix(p.Endpoint, "http://"))
|
||||
}
|
||||
sess := session.New(sessCfg)
|
||||
|
||||
c := s3.New(sess)
|
||||
cf := cloudfront.New(sess)
|
||||
r := make([]string, 1, 1)
|
||||
|
Loading…
Reference in New Issue
Block a user