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

Refactor configuration

Add Swagger url configuration.
Remove unused configuration.
parent e57da6a4
No related branches found
No related tags found
No related merge requests found
Pipeline #187563 passed
......@@ -6,7 +6,6 @@ Configuration may be set using SpringBoot's configuration file (`application.pro
| 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 |
......@@ -18,3 +17,4 @@ Configuration may be set using SpringBoot's configuration file (`application.pro
| 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 |
| NAMING_SWAGGER_URL | http://localhost:8080/swagger-ui.html | default url for Swagger UI |
......@@ -62,10 +62,10 @@ public class NotificationService {
private static final String BACKEND_URL = "backendurl";
private static final String COMMA = ",";
@Value("${naming.backend.swagger.url}")
String namingBackendSwaggerUrl;
@Value("${naming.mail.administrator}")
String namingMailAdministrator;
@Value("${naming.swagger.url}")
String namingSwaggerUrl;
private MailService mailService;
......@@ -131,7 +131,7 @@ public class NotificationService {
ctx.setVariable("updated", updated);
ctx.setVariable("deleted", deleted);
ctx.setVariable(ADD_FOOTER, true);
ctx.setVariable(BACKEND_URL, namingBackendSwaggerUrl);
ctx.setVariable(BACKEND_URL, namingSwaggerUrl);
TemplateEngine engine = generateTemplateEngine();
// send notification
......@@ -140,7 +140,7 @@ public class NotificationService {
: null;
String[] ccEmailAddresses = null;
String[] replyToEmailAddresses = null;
String subject = CHANGES_NOTIFICATION_NAMES + " - " + namingBackendSwaggerUrl;
String subject = CHANGES_NOTIFICATION_NAMES + " - " + namingSwaggerUrl;
mailService.sendEmail(toEmailAddresses, ccEmailAddresses, replyToEmailAddresses,
subject, engine.process("templates/notification_names.html", ctx), false, null, null);
}
......@@ -201,7 +201,7 @@ public class NotificationService {
ctx.setVariable("updated", updated);
ctx.setVariable("deleted", deleted);
ctx.setVariable(ADD_FOOTER, true);
ctx.setVariable(BACKEND_URL, namingBackendSwaggerUrl);
ctx.setVariable(BACKEND_URL, namingSwaggerUrl);
TemplateEngine engine = generateTemplateEngine();
// send notification
......@@ -210,7 +210,7 @@ public class NotificationService {
: null;
String[] ccEmailAddresses = null;
String[] replyToEmailAddresses = null;
String subject = CHANGES_NOTIFICATION_STRUCTURES + " - " + namingBackendSwaggerUrl;
String subject = CHANGES_NOTIFICATION_STRUCTURES + " - " + namingSwaggerUrl;
mailService.sendEmail(toEmailAddresses, ccEmailAddresses, replyToEmailAddresses,
subject, engine.process("templates/notification_structures.html", ctx), false, null, null);
}
......
......@@ -2,8 +2,8 @@
# Naming
# ------------------------------------------------------------------------------
# backend
naming.backend.swagger.url=${NAMING_BACKEND_SWAGGER_URL:http://localhost:8080/swagger-ui.html}
# configuration
spring.config.import=optional:file:.env[.properties]
# logging
naming.logging.stacktrace.length=10
......@@ -30,19 +30,12 @@ spring.mail.properties.mail.smtp.timeout=3000
spring.mail.properties.mail.smtp.writetimeout=5000
spring.mail.debug=false
# spring
# profiles
# config
# data
# datasource
# jpa
spring.profiles.active=@spring.profiles.active@
spring.config.import=optional:file:.env[.properties]
spring.datasource.url=${NAMING_DATABASE_URL:jdbc:postgresql://postgres:5432/discs_names}
spring.datasource.username=${NAMING_DATABASE_USERNAME:discs_names}
spring.datasource.password=${NAMING_DATABASE_PASSWORD:discs_names}
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.show-sql=true
......@@ -71,10 +64,12 @@ openapi.info.license.name=Copyright (C) 2022 European Spallation Source ERIC.
openapi.info.title=Naming REST API
# springdoc
# sort the tags
# sort the operation list of each API
# api
# swagger
# url used for notification
springdoc.swagger-ui.tagsSorter=alpha
springdoc.swagger-ui.operationsSorter=method
naming.swagger.url=${NAMING_SWAGGER_URL:http://localhost:8080/swagger-ui.html}
# metrics
# actuator
......
......@@ -2,8 +2,8 @@
# Naming
# ------------------------------------------------------------------------------
# backend
naming.backend.swagger.url=${NAMING_BACKEND_SWAGGER_URL:http://localhost:8080/swagger-ui.html}
# configuration
spring.config.import=optional:file:.env[.properties]
# logging
naming.logging.stacktrace.length=10
......@@ -30,20 +30,13 @@ spring.mail.properties.mail.smtp.timeout=3000
spring.mail.properties.mail.smtp.writetimeout=5000
spring.mail.debug=false
# spring
# profiles
# config
# data
# datasource
# jpa
spring.profiles.active=@spring.profiles.active@
spring.config.import=optional:file:.env[.properties]
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1
spring.datasource.username=sa
spring.datasource.password=sa
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.show-sql=true
......@@ -72,10 +65,12 @@ openapi.info.license.name=Copyright (C) 2022 European Spallation Source ERIC.
openapi.info.title=Naming REST API
# springdoc
# sort the tags
# sort the operation list of each API
# api
# swagger
# url used for notification
springdoc.swagger-ui.tagsSorter=alpha
springdoc.swagger-ui.operationsSorter=method
naming.swagger.url=${NAMING_SWAGGER_URL:http://localhost:8080/swagger-ui.html}
# metrics
# actuator
......
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