Skip to content

Commit

Permalink
use env variable for aws region
Browse files Browse the repository at this point in the history
  • Loading branch information
maggarwal13 committed Aug 27, 2020
1 parent a270fa8 commit 90cca63
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,11 @@
@Profile(WhoisProfile.AWS_DEPLOYED)
@PropertySource(value = "classpath:version.properties", ignoreResourceNotFound = true)
public class WhoisAWSPropertyResolver {

private static final Logger LOGGER = LoggerFactory.getLogger(WhoisAWSPropertyResolver.class);

//TODO: get region to deploy from gitlab
private static final String REGION = "eu-central-1";

@Bean
public static PropertySourcesPlaceholderConfigurer properties(){
LOGGER.info("AWS profile : using ssm parameter store ");
LOGGER.info("AWS profile : using ssm parameter store");

Properties properties = new Properties();
properties.putAll( getParametersByEnvAndApp("/whois/"));
Expand All @@ -45,7 +41,7 @@ public static PropertySourcesPlaceholderConfigurer properties(){

public static Map<String, Object> getParametersByEnvAndApp(final String path) {
final AWSSimpleSystemsManagement awsSimpleSystemsManagement = AWSSimpleSystemsManagementClient.builder()
.withRegion(REGION).build();
.withRegion(System.getenv("AWS_REGION") ).build();

final GetParametersByPathRequest getParametersByPathRequest = new GetParametersByPathRequest()
.withPath(path)
Expand Down

0 comments on commit 90cca63

Please sign in to comment.