Skip to content

Commit fc96bff

Browse files
author
Aaron Schlesinger
committed
fix(client.go,run.go,config.go): specify storage region
1 parent ae2754a commit fc96bff

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

pkg/gitreceive/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type Config struct {
1818
Username string `envconfig:"USERNAME" required:"true"`
1919
Fingerprint string `envconfig:"FINGERPRINT" required:"true"`
2020
PodNamespace string `envconfig:"POD_NAMESPACE" required:"true"`
21+
StorageRegion string `envconfig:"STORAGE_REGION" default:""`
2122
}
2223

2324
func (c Config) App() string {

pkg/gitreceive/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func Run(conf *Config) error {
3232
}
3333
builderKey := string(builderKeyBytes)
3434

35-
s3Client, err := storage.GetClient()
35+
s3Client, err := storage.GetClient(conf.StorageRegion)
3636
if err != nil {
3737
return fmt.Errorf("configuring S3 client (%s)", err)
3838
}

pkg/gitreceive/storage/client.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import (
66
"github.com/aws/aws-sdk-go/service/s3"
77
)
88

9-
func GetClient() (*s3.S3, error) {
9+
func GetClient(region string) (*s3.S3, error) {
1010
awsCfg := new(aws.Config)
11+
awsCfg.Region = aws.String(region)
1112
endpt, err := getEndpoint()
1213
if err != nil {
1314
return nil, err

0 commit comments

Comments
 (0)