Skip to content

Commit

Permalink
Merge pull request #22 from transcom/B-20564-Email-For-Malfomred-TAC-…
Browse files Browse the repository at this point in the history
…LOA-Data

Adding sender and recipient env variables
  • Loading branch information
TevinAdams authored Aug 9, 2024
2 parents f8ae449 + 5e4ca43 commit 745097f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ require TRDM_LAMBDA_MILMOVE_KEYPAIR_KEY "See 'DISABLE_AWS_VAULT_WRAPPER=1 AWS_RE
require TRDM_LAMBDA_MILMOVE_KEYPAIR_ALIAS "See 'DISABLE_AWS_VAULT_WRAPPER=1 AWS_REGION=us-gov-west-1 aws-vault exec transcom-gov-dev -- chamber read trdm-lambda-dev trdm_lambda_milmove_keypair_alias'"
require TRDM_LAMBDA_MILMOVE_KEYPAIR_TYPE "See 'DISABLE_AWS_VAULT_WRAPPER=1 AWS_REGION=us-gov-west-1 aws-vault exec transcom-gov-dev -- chamber read trdm-lambda-dev trdm_lambda_milmove_keypair_type'"
require TRDM_LAMBDA_MILMOVE_KEYPAIR_FILEPATH "See 'DISABLE_AWS_VAULT_WRAPPER=1 AWS_REGION=us-gov-west-1 aws-vault exec transcom-gov-dev -- chamber read trdm-lambda-dev trdm_lambda_milmove_keypair_filepath'"
require SES_SENDER_EMAIL "See 'DISABLE_AWS_VAULT_WRAPPER=1 AWS_REGION=us-gov-west-1 aws-vault exec transcom-gov-dev -- chamber read trdm-lambda-dev ses_sender_email'"
require SES_RECIPIENT "See 'DISABLE_AWS_VAULT_WRAPPER=1 AWS_REGION=us-gov-west-1 aws-vault exec transcom-gov-dev -- chamber read trdm-lambda-dev ses_recipient'"

##############################################
# Load Local Overrides and Check Environment #
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>
<groupId>com.milmove.trdmlambda</groupId>
<artifactId>trdm-lambda</artifactId>
<version>1.0.3.12</version>
<version>1.0.3.13</version>
<name>trdm java spring interface</name>
<description>Project for deploying a Java TRDM interfacer for TGET data.</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.milmove.trdmlambda.milmove.service;

import org.glassfish.jaxb.runtime.v2.schemagen.xmlschema.List;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.milmove.trdmlambda.milmove.util.SecretFetcher;

import ch.qos.logback.classic.Logger;
import jakarta.mail.MessagingException;
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
Expand Down Expand Up @@ -39,8 +40,6 @@ public EmailService() throws URISyntaxException {
.credentialsProvider(DefaultCredentialsProvider.create())
.endpointOverride(new URI(sesVPCEndpoint))
.build();
this.sender = "milmove-developers@caci.com";
this.recipient = "milmove-developers@caci.com";

logger.info("finished initializing Email Service");
}
Expand Down Expand Up @@ -98,6 +97,10 @@ public void sendMalformedLOADataEmail(ArrayList<String> loaSysIds) {
}

public void send(SesClient client) throws MessagingException {
SecretFetcher secretFetcher = new SecretFetcher();
this.sender = secretFetcher.getSecret("ses_sender_email");
this.recipient = secretFetcher.getSecret("ses_recipient");

logger.info("start of EmailService.send()");
Destination destination = Destination.builder()
.toAddresses(this.recipient)
Expand Down

0 comments on commit 745097f

Please sign in to comment.