Commit f19ba50f authored by Noel Alonso's avatar Noel Alonso
Browse files

Descarta envío de mensaje en entorno de tests

parent 38b0ffa6
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -18,12 +18,18 @@ public class AlertService {
	@Value("${alert.email}")
	private String ALERT_EMAIL;

	@Value("${spring.profiles.active}")
	private String PROFILE_ACTIVE;

	@Autowired
	private KafkaTemplate<String, Message> kafkaTemplate;

	public void errorAlert(String subject, String message) {

		String subjectDefault = "[ERROR] ";
		if (PROFILE_ACTIVE.equals("test"))
			return;

		String subjectDefault = "[ERROR][" + PROFILE_ACTIVE + "] ";
		send(new Message(ALERT_EMAIL, subjectDefault + subject, message, AlertType.ERROR.name()));
	}