diff --git a/README.md b/README.md index cacc1ec6..6eb58a32 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,9 @@ make run # or run it in debug mode GATEWAY_API_CONTROLLER_LOGLEVEL=debug make run + +# to run it against specific lattice service endpoint +LATTICE_ENDPOINT=https://mercury-gamma.us-west-2.amazonaws.com/ make run ``` ## End-to-End Testing diff --git a/pkg/aws/services/vpclattice.go b/pkg/aws/services/vpclattice.go index 87b759fa..f35826ef 100644 --- a/pkg/aws/services/vpclattice.go +++ b/pkg/aws/services/vpclattice.go @@ -2,6 +2,8 @@ package services import ( "context" + "github.com/golang/glog" + "os" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" @@ -30,11 +32,16 @@ const ( func NewDefaultLattice(sess *session.Session, region string) *defaultLattice { var latticeSess vpclatticeiface.VpcLatticeAPI - if region == "us-east-1" { - latticeSess = vpclattice.New(sess, aws.NewConfig().WithRegion("us-east-1").WithEndpoint("https://mercury-beta.us-east-1.amazonaws.com/")) - } else { - latticeSess = vpclattice.New(sess, aws.NewConfig().WithRegion("us-west-2").WithEndpoint(BetaProdEndpoint)) + endpoint := os.Getenv("LATTICE_ENDPOINT") + + if endpoint == "" { + endpoint = BetaProdEndpoint } + + latticeSess = vpclattice.New(sess, aws.NewConfig().WithRegion("us-west-2").WithEndpoint(endpoint)) + + glog.V(2).Infoln("Lattice Service EndPoint:", endpoint) + return &defaultLattice{VpcLatticeAPI: latticeSess} }