Merge branch 'feature/email-disable' into 'release'
Adding a flag to determine if we should send emails for that particular environment This is to prevent us from sending erroneous emails from our dev/test environments See merge request theappsmith/internal-tools-server!120
This commit is contained in:
commit
9caa6d42b8
|
|
@ -0,0 +1,16 @@
|
|||
package com.appsmith.server.configurations;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Configuration
|
||||
public class EmailConfig {
|
||||
|
||||
@Value("${mail.enabled}")
|
||||
private boolean emailEnabled = true;
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.appsmith.server.notifications;
|
||||
|
||||
import com.appsmith.server.configurations.EmailConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.mail.SimpleMailMessage;
|
||||
|
|
@ -13,9 +14,17 @@ public class EmailSender {
|
|||
@Autowired
|
||||
JavaMailSender emailSender;
|
||||
|
||||
@Autowired
|
||||
EmailConfig emailConfig;
|
||||
|
||||
private final String MAIL_FROM = "hello@appsmith.com";
|
||||
|
||||
public void sendMail(String to, String subject, String text) {
|
||||
// Don't send an email for local, dev or test environments
|
||||
if(!emailConfig.isEmailEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
log.debug("Going to send email to {} with subject {}", to, subject);
|
||||
|
||||
SimpleMailMessage message = new SimpleMailMessage();
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ acl.host=http://opa:8181/v1/data
|
|||
acl.package.name=/appsmith/authz/url_allow
|
||||
|
||||
# Mail Properties
|
||||
mail.enabled=true
|
||||
spring.mail.host=email-smtp.us-east-1.amazonaws.com
|
||||
spring.mail.port=587
|
||||
spring.mail.username=AKIAVWHAAGIQOHPT4BZ7
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ acl.host=http://localhost:8181/v1/data
|
|||
acl.package.name=/appsmith/authz/url_allow
|
||||
|
||||
# Mail Properties
|
||||
mail.enabled=false
|
||||
spring.mail.host=email-smtp.us-east-1.amazonaws.com
|
||||
spring.mail.port=587
|
||||
spring.mail.username=AKIAVWHAAGIQOHPT4BZ7
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ acl.host=https://openpolicyagent.herokuapp.com/v1/data
|
|||
acl.package.name=/appsmith/authz/url_allow
|
||||
|
||||
# Mail Properties
|
||||
mail.enabled=true
|
||||
spring.mail.host=email-smtp.us-east-1.amazonaws.com
|
||||
spring.mail.port=587
|
||||
spring.mail.username=AKIAVWHAAGIQOHPT4BZ7
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ acl.package.name=/appsmith/authz/url_allow
|
|||
|
||||
|
||||
# Mail Properties
|
||||
mail.enabled=false
|
||||
spring.mail.host=email-smtp.us-east-1.amazonaws.com
|
||||
spring.mail.port=587
|
||||
spring.mail.username=AKIAVWHAAGIQOHPT4BZ7
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user