fix: pass region from env

This commit is contained in:
Tobiasz Heller 2024-01-24 21:05:16 +01:00
parent 782e77173d
commit ce476fe477
2 changed files with 6 additions and 1 deletions

View File

@ -4,4 +4,5 @@ type PassConfig struct {
Addr string `envconfig:"PASS_ADDR" default:":8082"`
KMSKeyID string `envconfig:"KMS_KEY_ID" default:"alias/pass_service_signing_key"`
AWSEndpoint string `envconfig:"AWS_ENDPOINT" default:""`
AWSRegion string `envconfig:"AWS_REGION" default:"us-east-2"`
}

View File

@ -25,8 +25,12 @@ func NewServer(cfg config.PassConfig) *Server {
if cfg.AWSEndpoint != "" {
awsEndpoint = aws.String(cfg.AWSEndpoint)
}
region := cfg.AWSRegion
if region == "" {
region = "us-east-1"
}
sess, err := session.NewSession(&aws.Config{
Region: aws.String("us-east-1"),
Region: aws.String(region),
S3ForcePathStyle: aws.Bool(true),
Endpoint: awsEndpoint,
})