Skip to content

Commit

Permalink
Add mail templates configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-emilius committed Jul 29, 2024
1 parent 51dce35 commit aa65356
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ EXPOSE 8080
RUN mkdir /app

COPY --from=build /home/gradle/src/build/libs/*.jar /app/server.jar
COPY --from=build /home/gradle/src/mails /app/mails
COPY ./mail-templates /default-mail-templates

ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app/server.jar"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ public class MailingService {
private final String workspaceUrl;
private final String sender;
private final List<String> chairMemberRecipientsList;
private final Path rootLocation;
private final Path mailTemplateLocation;

@Autowired
public MailingService(
JavaMailSender javaMailSender,
UploadService uploadService,
@Value("${thesis-track.mail.enabled}") boolean enabled,
@Value("${thesis-track.mail.mail-template-location}") String mailTemplateLocation,
@Value("${thesis-track.mail.sender}") String sender,
@Value("${thesis-track.mail.chair-member-recipients}") String chairMemberRecipientsList,
@Value("${thesis-track.mail.footer}") String mailFooter,
Expand All @@ -53,7 +54,7 @@ public MailingService(
this.sender = sender;
this.workspaceUrl = workspaceUrl;
this.mailFooter = mailFooter;
this.rootLocation = Paths.get("mails");
this.mailTemplateLocation = Paths.get(mailTemplateLocation);

if (chairMemberRecipientsList != null && !chairMemberRecipientsList.isEmpty()) {
this.chairMemberRecipientsList = Arrays.asList(chairMemberRecipientsList.split(";"));
Expand Down Expand Up @@ -172,7 +173,7 @@ public void sendApplicationRejectionEmail(Application application) throws Mailin
}

private String getMailTemplate(String name) throws MailingException {
Path filePath = rootLocation.resolve(name + ".html");
Path filePath = mailTemplateLocation.resolve(name + ".html");

try {
byte[] fileBytes = Files.readAllBytes(filePath);
Expand Down
1 change: 1 addition & 0 deletions server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ thesis-track:
footer: ${MAIL_FOOTER:}
workspace-url: ${MAIL_WORKSPACE_URL:https://slack.com}
chair-member-recipients: ${MAIL_CHAIR_RECIPIENTS:}
mail-template-location: ${MAIL_TEMPLATE_FOLDER:/default-mail-templates}
storage:
upload-location: ${UPLOAD_FOLDER:uploads}

Expand Down

0 comments on commit aa65356

Please sign in to comment.