File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
src/main/java/net/snowflake/client/core/auth/wif Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change 1515@ SnowflakeJdbcInternalApi
1616public class AWSAttestationService {
1717
18- private static final AWS4Signer aws4Signer ;
18+ private static boolean regionInitialized = false ;
19+ private static String region ;
1920
20- static {
21+ private final AWS4Signer aws4Signer ;
22+
23+ public AWSAttestationService () {
2124 aws4Signer = new AWS4Signer ();
2225 aws4Signer .setServiceName ("sts" );
2326 }
@@ -27,12 +30,12 @@ AWSCredentials getAWSCredentials() {
2730 }
2831
2932 String getAWSRegion () {
30- String region = SnowflakeUtil .systemGetEnv ("AWS_REGION" );
31- if (region != null ) {
32- return region ;
33- } else {
34- return new InstanceMetadataRegionProvider ().getRegion ();
33+ if (!regionInitialized ) {
34+ String envRegion = SnowflakeUtil .systemGetEnv ("AWS_REGION" );
35+ region = envRegion != null ? envRegion : new InstanceMetadataRegionProvider ().getRegion ();
36+ regionInitialized = true ;
3537 }
38+ return region ;
3639 }
3740
3841 String getArn () {
You can’t perform that action at this time.
0 commit comments