Skip to content
Snippets Groups Projects
Commit 933346e5 authored by Lars Johansson's avatar Lars Johansson
Browse files

Refactor notification scheduling to read schedule from configuration

parent bb78c117
No related branches found
No related tags found
No related merge requests found
Pipeline #172295 passed
......@@ -4,16 +4,17 @@ Configuration may be set using SpringBoot's configuration file (`application.pro
##### Environment variables
| Variable | Default | Description |
|----------------------------|---------------------------------------------|-------------------------------------------------------|
| NAMING_BACKEND_SWAGGER_URL | http://localhost:8080/swagger-ui.html | default url for Swagger UI |
| NAMING_DATABASE_URL | jdbc:postgresql://postgres:5432/discs_names | JDBC URL for the database connection |
| NAMING_DATABASE_USERNAME | discs_names | user name for the database connection |
| NAMING_DATABASE_PASSWORD | discs_names | password for the database connection |
| NAMING_LOGGING_LEVEL | INFO | log level for application |
| NAMING_MAIL_ADMINISTRATOR | | comma-separated list of administrator email addresses |
| NAMING_MAIL_NOTIFICATION | false | true/false if mail notications are to be sent |
| NAMING_SMTP_HOST | mail.esss.lu.se | DNS name of server that accepts connections for SMTP |
| NAMING_SMTP_PORT | 587 | port to use for SMTP, 587 for SMTP Secure |
| NAMING_SMTP_USERNAME | | username for SMTP server |
| NAMING_SMTP_PASSWORD | | password for SMTP server |
| Variable | Default | Description |
|----------------------------|---------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
| NAMING_BACKEND_SWAGGER_URL | http://localhost:8080/swagger-ui.html | default url for Swagger UI |
| NAMING_DATABASE_URL | jdbc:postgresql://postgres:5432/discs_names | JDBC URL for the database connection |
| NAMING_DATABASE_USERNAME | discs_names | user name for the database connection |
| NAMING_DATABASE_PASSWORD | discs_names | password for the database connection |
| NAMING_LOGGING_LEVEL | INFO | log level for application |
| NAMING_MAIL_ADMINISTRATOR | | comma-separated list of administrator email addresses |
| NAMING_MAIL_NOTIFICATION | false | true/false if mail notications are to be sent |
| NAMING_NOTIFY_SCHEDULE | 0 0 5 * * * | schedule for notification job, cron expression with six or seven fields to describe individual details of the schedule |
| NAMING_SMTP_HOST | mail.esss.lu.se | DNS name of server that accepts connections for SMTP |
| NAMING_SMTP_PORT | 587 | port to use for SMTP, 587 for SMTP Secure |
| NAMING_SMTP_USERNAME | | username for SMTP server |
| NAMING_SMTP_PASSWORD | | password for SMTP server |
......@@ -68,7 +68,7 @@ public class NotificationScheduler {
* <br/><br/>
* Scheduling is handled with cron expression.
*/
@Scheduled(cron = "0 0 5 * * *")
@Scheduled(cron = "${naming.notify.schedule}")
public void notifyAdministrators() {
notifyAdministratorsForNames();
}
......
......@@ -12,8 +12,10 @@ logging.level.org.springframework.web=INFO
logging.level.org.hibernate.SQL=INFO
spring.http.log-request-details=true
# mail
# mail, notification
# administrator mail is comma-separated list of email addresses
# notification job scheduled at 5 am every day by default
naming.notify.schedule=${NAMING_NOTIFY_SCHEDULE:0 0 5 * * *}
naming.mail.administrator=${NAMING_MAIL_ADMINISTRATOR:}
naming.mail.notification=${NAMING_MAIL_NOTIFICATION:false}
naming.mail.from=${NAMING_MAIL_FROM:jboss@ess.eu}
......
......@@ -12,8 +12,10 @@ logging.level.org.springframework.web=INFO
logging.level.org.hibernate.SQL=INFO
spring.http.log-request-details=true
# mail
# mail, notification
# administrator mail is comma-separated list of email addresses
# notification job scheduled at 5 am every day by default
naming.notify.schedule=${NAMING_NOTIFY_SCHEDULE:0 0 5 * * *}
naming.mail.administrator=${NAMING_MAIL_ADMINISTRATOR:}
naming.mail.notification=${NAMING_MAIL_NOTIFICATION:false}
naming.mail.from=${NAMING_MAIL_FROM:jboss@ess.eu}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment