Enable dual stack for yumrepofs s3

This commit is contained in:
Mustafa Gezen 2023-07-18 16:59:32 +02:00
parent 320a10d11c
commit 71e4fd8618
Signed by untrusted user who does not match committer: mustafa
GPG Key ID: DCDF010D946438C1
2 changed files with 5 additions and 1 deletions

View File

@ -19,6 +19,7 @@ go_library(
"//utils", "//utils",
"//vendor/github.com/aws/aws-sdk-go/aws", "//vendor/github.com/aws/aws-sdk-go/aws",
"//vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds", "//vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds",
"//vendor/github.com/aws/aws-sdk-go/aws/endpoints",
"//vendor/github.com/aws/aws-sdk-go/aws/session", "//vendor/github.com/aws/aws-sdk-go/aws/session",
"//vendor/github.com/aws/aws-sdk-go/service/s3", "//vendor/github.com/aws/aws-sdk-go/service/s3",
"//vendor/github.com/go-git/go-billy/v5/osfs", "//vendor/github.com/go-git/go-billy/v5/osfs",

View File

@ -34,6 +34,7 @@ import (
"context" "context"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials/stscreds" "github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/session"
awss3 "github.com/aws/aws-sdk-go/service/s3" awss3 "github.com/aws/aws-sdk-go/service/s3"
"github.com/go-git/go-billy/v5/osfs" "github.com/go-git/go-billy/v5/osfs"
@ -66,7 +67,9 @@ func NewServer(db peridotdb.Access, session *session.Session) (*Server, error) {
return nil, err return nil, err
} }
cfg := &aws.Config{} cfg := &aws.Config{
UseDualStackEndpoint: endpoints.DualStackEndpointStateEnabled,
}
if assumeRole := viper.GetString("s3-assume-role"); assumeRole != "" { if assumeRole := viper.GetString("s3-assume-role"); assumeRole != "" {
cfg.Credentials = stscreds.NewCredentials(session, assumeRole) cfg.Credentials = stscreds.NewCredentials(session, assumeRole)
} }