From 8aac65fbd68a185938fd92b0523f862e3ca7bde7 Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Mon, 25 Nov 2024 19:03:30 +0100 Subject: [PATCH 01/11] [#80] Implement configuration class --- .../kbss/study/RecordManagerApplication.java | 3 +- .../cvut/kbss/study/util/Configuration.java | 433 ++++++++++++++++++ 2 files changed, 435 insertions(+), 1 deletion(-) create mode 100644 src/main/java/cz/cvut/kbss/study/util/Configuration.java diff --git a/src/main/java/cz/cvut/kbss/study/RecordManagerApplication.java b/src/main/java/cz/cvut/kbss/study/RecordManagerApplication.java index 28ae628..0d98ac0 100644 --- a/src/main/java/cz/cvut/kbss/study/RecordManagerApplication.java +++ b/src/main/java/cz/cvut/kbss/study/RecordManagerApplication.java @@ -2,9 +2,10 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.PropertySource; +import org.springframework.boot.context.properties.ConfigurationPropertiesScan; @SpringBootApplication +@ConfigurationPropertiesScan public class RecordManagerApplication { public static void main(String[] args) { diff --git a/src/main/java/cz/cvut/kbss/study/util/Configuration.java b/src/main/java/cz/cvut/kbss/study/util/Configuration.java new file mode 100644 index 0000000..b6bb188 --- /dev/null +++ b/src/main/java/cz/cvut/kbss/study/util/Configuration.java @@ -0,0 +1,433 @@ +package cz.cvut.kbss.study.util; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "") +public class Configuration { + + /** + * Url of the website for password reset emails. e.g. https://study.com/ (must have "/" at the end) + */ + String appContext; + + /** + * Driver to manage triple stores + */ + String driver; + + /** + * URL of repository that holds main data of the application + */ + String repositoryUrl; + + /** + * URL of repository where output and configuration of form-generator should be held + */ + String formGenRepositoryUrl; + + /** + * REST endpoint of form generator service + */ + String formGenServiceUrl; + + Smtp smtp = new Smtp(); + Email email = new Email(); + Security security = new Security(); + Records records = new Records(); + + public String getAppContext() { + return appContext; + } + + public void setAppContext(String appContext) { + this.appContext = appContext; + } + + public String getDriver() { + return driver; + } + + public void setDriver(String driver) { + this.driver = driver; + } + + public String getRepositoryUrl() { + return repositoryUrl; + } + + public void setRepositoryUrl(String repositoryUrl) { + this.repositoryUrl = repositoryUrl; + } + + public String getFormGenRepositoryUrl() { + return formGenRepositoryUrl; + } + + public void setFormGenRepositoryUrl(String formGenRepositoryUrl) { + this.formGenRepositoryUrl = formGenRepositoryUrl; + } + + public String getFormGenServiceUrl() { + return formGenServiceUrl; + } + + public void setFormGenServiceUrl(String formGenServiceUrl) { + this.formGenServiceUrl = formGenServiceUrl; + } + + public Smtp getSmtp() { + return smtp; + } + + public void setSmtp(Smtp smtp) { + this.smtp = smtp; + } + + public Email getEmail() { + return email; + } + + public void setEmail(Email email) { + this.email = email; + } + + public Security getSecurity() { + return security; + } + + public void setSecurity(Security security) { + this.security = security; + } + + public Records getRecords() { + return records; + } + + public void setRecords(Records records) { + this.records = records; + } + + + public static class Smtp { + /** + * SMTP host + */ + String host; + + /** + * SMTP port + */ + String port; + + /** + * SMTP user + */ + String user; + + /** + * SMTP password + */ + String password; + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + } + + public static class Email { + /** + * Email display name + */ + String displayName; + + /** + * if email.from is not entered, smtp.user is used instead + */ + String from; + + /** + * Email cc addresses where all invitations will be sent. For more use delimiter "," (can remain empty) + */ + String replyTo; + + /** + * + */ + String cc; + + /** + * + */ + String bcc; + + /** + * You can use variables in email contents by using {{variable}}, available variables are listed before email content property + * Password Reset email subject + */ + String passwordResetSubject; + + /** + * PasswordReset email html content, variables: username, link, appContext + */ + String passwordResetContent; + + /** + * serInvite email subject + */ + String invitationSubject; + + /** + * UserInvite email html content, variables: username, link, name, appContext + */ + String invitationContent; + + /** + * Password change email + */ + String passwordChangeSubject; + + /** + * PasswordReset email html content, variables: username, appContext + */ + String passwordChangeContent; + + /** + * Profile update email + */ + String profileUpdateSubject; + + /** + * PasswordReset email html content, variables: username, appContext + */ + String profileUpdateContent; + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getFrom() { + return from; + } + + public void setFrom(String from) { + this.from = from; + } + + public String getReplyTo() { + return replyTo; + } + + public void setReplyTo(String replyTo) { + this.replyTo = replyTo; + } + + public String getCc() { + return cc; + } + + public void setCc(String cc) { + this.cc = cc; + } + + public String getBcc() { + return bcc; + } + + public void setBcc(String bcc) { + this.bcc = bcc; + } + + public String getPasswordResetSubject() { + return passwordResetSubject; + } + + public void setPasswordResetSubject(String passwordResetSubject) { + this.passwordResetSubject = passwordResetSubject; + } + + public String getPasswordResetContent() { + return passwordResetContent; + } + + public void setPasswordResetContent(String passwordResetContent) { + this.passwordResetContent = passwordResetContent; + } + + public String getInvitationSubject() { + return invitationSubject; + } + + public void setInvitationSubject(String invitationSubject) { + this.invitationSubject = invitationSubject; + } + + public String getInvitationContent() { + return invitationContent; + } + + public void setInvitationContent(String invitationContent) { + this.invitationContent = invitationContent; + } + + public String getPasswordChangeSubject() { + return passwordChangeSubject; + } + + public void setPasswordChangeSubject(String passwordChangeSubject) { + this.passwordChangeSubject = passwordChangeSubject; + } + + public String getPasswordChangeContent() { + return passwordChangeContent; + } + + public void setPasswordChangeContent(String passwordChangeContent) { + this.passwordChangeContent = passwordChangeContent; + } + + public String getProfileUpdateSubject() { + return profileUpdateSubject; + } + + public void setProfileUpdateSubject(String profileUpdateSubject) { + this.profileUpdateSubject = profileUpdateSubject; + } + + public String getProfileUpdateContent() { + return profileUpdateContent; + } + + public void setProfileUpdateContent(String profileUpdateContent) { + this.profileUpdateContent = profileUpdateContent; + } + } + + public static class Security { + + /** + * Provider of application security. Possible values are 'internal' for internally stored users and 'oidc' for using an + * OIDC-compatible authentication service. Its URL is configured via Spring Boot configuration parameters + */ + String provider; + + /** + * Option to pass sameSite attribute for set-cookie headers. Possible values are None,Lax,Strict. In case of None value also attribute "Secure;" is added. + */ + String sameSite; + private Oidc oidc = new Oidc(); + private Cors cord = new Cors(); + + public String getSameSite() { + return sameSite; + } + + + public void setSameSite(String sameSite) { + this.sameSite = sameSite; + } + + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public Oidc getOidc() { + return oidc; + } + + public void setOidc(Oidc oidc) { + this.oidc = oidc; + } + + public Cors getCord() { + return cord; + } + + public void setCord(Cors cord) { + this.cord = cord; + } + + public static class Oidc { + /** + * Claim containing user roles in the OIDC access token (applies only when 'oidc' security provider is selected). Use + * dot notation for nested objects + */ + String roleClaim; + + public String getRoleClaim() { + return roleClaim; + } + + public void setRoleClaim(String roleClaim) { + this.roleClaim = roleClaim; + } + } + + public static class Cors { + /** + * Configures allowed origins for CORS (e.g. http://localhost:3000). Use a comma to separate multiple values + */ + String allowedOrigins; + + public String getAllowedOrigins() { + return allowedOrigins; + } + + public void setAllowedOrigins(String allowedOrigins) { + this.allowedOrigins = allowedOrigins; + } + } + } + + public static class Records { + + /** + * it indicates functionality allowing users to specify a reason for rejection is enabled. + */ + boolean allowedRejectReason; + + public boolean isAllowedRejectReason() { + return allowedRejectReason; + } + + public void setAllowedRejectReason(boolean allowedRejectReason) { + this.allowedRejectReason = allowedRejectReason; + } + } +} From 9c28662b2de55485d352228691373c88d4c88466 Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Mon, 25 Nov 2024 19:06:06 +0100 Subject: [PATCH 02/11] [#80] Implement configuration.md --- doc/configuration.md | 30 ++++++++++++++++++++++++++++++ pom.xml | 11 +++++++++++ 2 files changed, 41 insertions(+) create mode 100644 doc/configuration.md diff --git a/doc/configuration.md b/doc/configuration.md new file mode 100644 index 0000000..b3448a8 --- /dev/null +++ b/doc/configuration.md @@ -0,0 +1,30 @@ +| Variable | Description | +| --- | --- | +| ```APPCONTEXT``` | Url of the website for password reset emails. e.g. https://study.com/ (must have "/" at the end) | +| ```DRIVER``` | Driver to manage triple stores | +| ```EMAIL_BCC``` | | +| ```EMAIL_CC``` | | +| ```EMAIL_DISPLAYNAME``` | Email display name | +| ```EMAIL_FROM``` | if email.from is not entered, smtp.user is used instead | +| ```EMAIL_INVITATIONCONTENT``` | UserInvite email html content, variables: username, link, name, appContext | +| ```EMAIL_INVITATIONSUBJECT``` | serInvite email subject | +| ```EMAIL_PASSWORDCHANGECONTENT``` | PasswordReset email html content, variables: username, appContext | +| ```EMAIL_PASSWORDCHANGESUBJECT``` | Password change email | +| ```EMAIL_PASSWORDRESETCONTENT``` | PasswordReset email html content, variables: username, link, appContext | +| ```EMAIL_PASSWORDRESETSUBJECT``` | You can use variables in email contents by using {{variable}}, available variables are listed before email content property
Password Reset email subject | +| ```EMAIL_PROFILEUPDATECONTENT``` | PasswordReset email html content, variables: username, appContext | +| ```EMAIL_PROFILEUPDATESUBJECT``` | Profile update email | +| ```EMAIL_REPLYTO``` | Email cc addresses where all invitations will be sent. For more use delimiter "," (can remain empty) | +| ```FORMGENREPOSITORYURL``` | URL of repository where output and configuration of form-generator should be held | +| ```FORMGENSERVICEURL``` | REST endpoint of form generator service | +| ```RECORDS_ALLOWEDREJECTREASON``` | it indicates functionality allowing users to specify a reason for rejection is enabled. | +| ```REPOSITORYURL``` | URL of repository that holds main data of the application | +| ```SECURITY_CORD_ALLOWEDORIGINS``` | Configures allowed origins for CORS (e.g. http://localhost:3000). Use a comma to separate multiple values | +| ```SECURITY_OIDC_ROLECLAIM``` | Claim containing user roles in the OIDC access token (applies only when 'oidc' security provider is selected). Use
dot notation for nested objects | +| ```SECURITY_PROVIDER``` | Provider of application security. Possible values are 'internal' for internally stored users and 'oidc' for using an
OIDC-compatible authentication service. Its URL is configured via Spring Boot configuration parameters | +| ```SECURITY_SAMESITE``` | Option to pass sameSite attribute for set-cookie headers. Possible values are None,Lax,Strict. In case of None value also attribute "Secure;" is added. | +| ```SMTP_HOST``` | SMTP host | +| ```SMTP_PASSWORD``` | SMTP password | +| ```SMTP_PORT``` | SMTP port | +| ```SMTP_USER``` | SMTP user | + diff --git a/pom.xml b/pom.xml index 7b93388..dde1f22 100644 --- a/pom.xml +++ b/pom.xml @@ -162,7 +162,18 @@ mapstruct-processor ${org.mapstruct.version} + + cz.lukaskabc.cvut.processor + spring-boot-configuration-docgen-processor + 1.0 + + + -Aconfigurationdoc.output_file=./doc/configuration.md + -Aconfigurationdoc.format=MD + -Aconfigurationdoc.prepend_required=true + -Aconfigurationdoc.configuration_package=cz.cvut.kbss.study + From e012140a06dbfa0b99ecc41e86d997fa0e7e3012 Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Mon, 25 Nov 2024 19:06:16 +0100 Subject: [PATCH 03/11] [#80] Update Readme.md --- README.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c6c95b6..16c8f36 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,8 @@ The system can be split into two parts. __Main application__ provides management ### Further Record Manager Configuration -The following table lists the names of environment variables that can be -passed to Record Manager backend either directly in `docker-compose.yml`, in -an [env_file](https://docs.docker.com/compose/compose-file/compose-file-v3/#env_file), or via command line. - -| Variable | Explanation | -|:---------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| ```RECORDS_ALLOWEDREJECTREASON``` | Allow user to enter reason when rejecting records. Default value: `false.` | +The table lists environment variables that can be passed to the Record Manager backend through `docker-compose.yml`, an [env_file](https://docs.docker.com/compose/compose-file/compose-file-v3/#env_file), +or the command line. For more details, see the [Configuration documentation](./doc/configuration.md). ## Documentation From 4a58eadf907560e850ff737c8a714a5c3d07c376 Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Tue, 26 Nov 2024 10:41:39 +0100 Subject: [PATCH 04/11] [#80] Create doc dir in a dockerfile Workaround for spring-boot-configuration-docgen-processor --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index b29f1c3..1faf430 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,8 @@ RUN mvn -B de.qaware.maven:go-offline-maven-plugin:resolve-dependencies COPY src src +RUN mkdir /record-manager/doc + RUN mvn package -B -DskipTests=true FROM eclipse-temurin:17-jdk-alpine as runtime From c7f283da50f474f6e5f26746422c2dd85bfd779e Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Wed, 27 Nov 2024 12:39:19 +0100 Subject: [PATCH 05/11] [#80] Update comments in Configuration class --- src/main/java/cz/cvut/kbss/study/util/Configuration.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/cz/cvut/kbss/study/util/Configuration.java b/src/main/java/cz/cvut/kbss/study/util/Configuration.java index b6bb188..196ffbf 100644 --- a/src/main/java/cz/cvut/kbss/study/util/Configuration.java +++ b/src/main/java/cz/cvut/kbss/study/util/Configuration.java @@ -6,7 +6,7 @@ public class Configuration { /** - * Url of the website for password reset emails. e.g. https://study.com/ (must have "/" at the end) + * Public URL of the frontend of record-manager application that is used for password reset emails. e.g. https://study.example.com/record-manager/ (must have "/" at the end) */ String appContext; @@ -180,12 +180,12 @@ public static class Email { String replyTo; /** - * + * Email addresses to be carbon-copied, separated by a comma (optional, can be empty). */ String cc; /** - * + * Email addresses to be blind carbon-copied, separated by a comma (optional, can be empty). */ String bcc; From 23545a65c6069e3fe1f79f101036e2ec6c4594b9 Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Wed, 27 Nov 2024 12:45:32 +0100 Subject: [PATCH 06/11] [#80] Update configuration.md --- doc/configuration.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/configuration.md b/doc/configuration.md index b3448a8..dea03f3 100644 --- a/doc/configuration.md +++ b/doc/configuration.md @@ -1,9 +1,9 @@ | Variable | Description | | --- | --- | -| ```APPCONTEXT``` | Url of the website for password reset emails. e.g. https://study.com/ (must have "/" at the end) | +| ```APPCONTEXT``` | Public URL of the frontend of record-manager application that is used for password reset emails. e.g. https://study.example.com/record-manager/ (must have "/" at the end) | | ```DRIVER``` | Driver to manage triple stores | -| ```EMAIL_BCC``` | | -| ```EMAIL_CC``` | | +| ```EMAIL_BCC``` | Email addresses to be blind carbon-copied, separated by a comma (optional, can be empty). | +| ```EMAIL_CC``` | Email addresses to be carbon-copied, separated by a comma (optional, can be empty). | | ```EMAIL_DISPLAYNAME``` | Email display name | | ```EMAIL_FROM``` | if email.from is not entered, smtp.user is used instead | | ```EMAIL_INVITATIONCONTENT``` | UserInvite email html content, variables: username, link, name, appContext | From 4b3c5872aefe544c922f27cdd5112be3617bbe10 Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Wed, 27 Nov 2024 12:54:59 +0100 Subject: [PATCH 07/11] [#80] Update Readme.md with content of configuration.md --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 16c8f36..57c9431 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,36 @@ The system can be split into two parts. __Main application__ provides management The table lists environment variables that can be passed to the Record Manager backend through `docker-compose.yml`, an [env_file](https://docs.docker.com/compose/compose-file/compose-file-v3/#env_file), or the command line. For more details, see the [Configuration documentation](./doc/configuration.md). +| Variable | Description | +| --- | --- | +| ```APPCONTEXT``` | Public URL of the frontend of record-manager application that is used for password reset emails. e.g. https://study.example.com/record-manager/ (must have "/" at the end) | +| ```DRIVER``` | Driver to manage triple stores | +| ```EMAIL_BCC``` | Email addresses to be blind carbon-copied, separated by a comma (optional, can be empty). | +| ```EMAIL_CC``` | Email addresses to be carbon-copied, separated by a comma (optional, can be empty). | +| ```EMAIL_DISPLAYNAME``` | Email display name | +| ```EMAIL_FROM``` | if email.from is not entered, smtp.user is used instead | +| ```EMAIL_INVITATIONCONTENT``` | UserInvite email html content, variables: username, link, name, appContext | +| ```EMAIL_INVITATIONSUBJECT``` | serInvite email subject | +| ```EMAIL_PASSWORDCHANGECONTENT``` | PasswordReset email html content, variables: username, appContext | +| ```EMAIL_PASSWORDCHANGESUBJECT``` | Password change email | +| ```EMAIL_PASSWORDRESETCONTENT``` | PasswordReset email html content, variables: username, link, appContext | +| ```EMAIL_PASSWORDRESETSUBJECT``` | You can use variables in email contents by using {{variable}}, available variables are listed before email content property
Password Reset email subject | +| ```EMAIL_PROFILEUPDATECONTENT``` | PasswordReset email html content, variables: username, appContext | +| ```EMAIL_PROFILEUPDATESUBJECT``` | Profile update email | +| ```EMAIL_REPLYTO``` | Email cc addresses where all invitations will be sent. For more use delimiter "," (can remain empty) | +| ```FORMGENREPOSITORYURL``` | URL of repository where output and configuration of form-generator should be held | +| ```FORMGENSERVICEURL``` | REST endpoint of form generator service | +| ```RECORDS_ALLOWEDREJECTREASON``` | it indicates functionality allowing users to specify a reason for rejection is enabled. | +| ```REPOSITORYURL``` | URL of repository that holds main data of the application | +| ```SECURITY_CORD_ALLOWEDORIGINS``` | Configures allowed origins for CORS (e.g. http://localhost:3000). Use a comma to separate multiple values | +| ```SECURITY_OIDC_ROLECLAIM``` | Claim containing user roles in the OIDC access token (applies only when 'oidc' security provider is selected). Use
dot notation for nested objects | +| ```SECURITY_PROVIDER``` | Provider of application security. Possible values are 'internal' for internally stored users and 'oidc' for using an
OIDC-compatible authentication service. Its URL is configured via Spring Boot configuration parameters | +| ```SECURITY_SAMESITE``` | Option to pass sameSite attribute for set-cookie headers. Possible values are None,Lax,Strict. In case of None value also attribute "Secure;" is added. | +| ```SMTP_HOST``` | SMTP host | +| ```SMTP_PASSWORD``` | SMTP password | +| ```SMTP_PORT``` | SMTP port | +| ```SMTP_USER``` | SMTP user | + ## Documentation Build configuration and deployment are described in [Setup Guide](doc/setup.md). From 7f19d504d9018400dedc29a4a6c3a748c232deca Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Fri, 29 Nov 2024 17:43:04 +0100 Subject: [PATCH 08/11] [#80] Update spring-boot-configuration-docgen-processor to 1.1. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index dde1f22..a0027b8 100644 --- a/pom.xml +++ b/pom.xml @@ -165,7 +165,7 @@ cz.lukaskabc.cvut.processor spring-boot-configuration-docgen-processor - 1.0 + 1.1 From 77dccf5daec3ccffb4c27e9bc47dd38c86919c28 Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Fri, 29 Nov 2024 17:43:47 +0100 Subject: [PATCH 09/11] [#80] Remove creation of the `/doc` dir from Dockerfile --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1faf430..b29f1c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,6 @@ RUN mvn -B de.qaware.maven:go-offline-maven-plugin:resolve-dependencies COPY src src -RUN mkdir /record-manager/doc - RUN mvn package -B -DskipTests=true FROM eclipse-temurin:17-jdk-alpine as runtime From bb3f890e24802ccc314d776759b8baa5229ef690 Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Fri, 29 Nov 2024 17:51:15 +0100 Subject: [PATCH 10/11] [#80] Rename driver property to persistenceDriver --- doc/configuration.md | 2 +- .../study/persistence/FormGenPersistenceFactory.java | 5 ++--- .../kbss/study/persistence/PersistenceFactory.java | 4 ++-- .../java/cz/cvut/kbss/study/util/ConfigParam.java | 2 +- .../java/cz/cvut/kbss/study/util/Configuration.java | 12 ++++++------ src/main/resources/application.properties | 2 +- .../persistence/TestFormGenPersistenceFactory.java | 2 +- .../study/persistence/TestPersistenceFactory.java | 2 +- src/test/resources/application.properties | 9 ++------- 9 files changed, 17 insertions(+), 23 deletions(-) diff --git a/doc/configuration.md b/doc/configuration.md index dea03f3..5f65140 100644 --- a/doc/configuration.md +++ b/doc/configuration.md @@ -1,7 +1,6 @@ | Variable | Description | | --- | --- | | ```APPCONTEXT``` | Public URL of the frontend of record-manager application that is used for password reset emails. e.g. https://study.example.com/record-manager/ (must have "/" at the end) | -| ```DRIVER``` | Driver to manage triple stores | | ```EMAIL_BCC``` | Email addresses to be blind carbon-copied, separated by a comma (optional, can be empty). | | ```EMAIL_CC``` | Email addresses to be carbon-copied, separated by a comma (optional, can be empty). | | ```EMAIL_DISPLAYNAME``` | Email display name | @@ -17,6 +16,7 @@ | ```EMAIL_REPLYTO``` | Email cc addresses where all invitations will be sent. For more use delimiter "," (can remain empty) | | ```FORMGENREPOSITORYURL``` | URL of repository where output and configuration of form-generator should be held | | ```FORMGENSERVICEURL``` | REST endpoint of form generator service | +| ```PERSISTENCEDRIVER``` | Persistence driver to manage triple stores | | ```RECORDS_ALLOWEDREJECTREASON``` | it indicates functionality allowing users to specify a reason for rejection is enabled. | | ```REPOSITORYURL``` | URL of repository that holds main data of the application | | ```SECURITY_CORD_ALLOWEDORIGINS``` | Configures allowed origins for CORS (e.g. http://localhost:3000). Use a comma to separate multiple values | diff --git a/src/main/java/cz/cvut/kbss/study/persistence/FormGenPersistenceFactory.java b/src/main/java/cz/cvut/kbss/study/persistence/FormGenPersistenceFactory.java index 0bab533..70a80cb 100644 --- a/src/main/java/cz/cvut/kbss/study/persistence/FormGenPersistenceFactory.java +++ b/src/main/java/cz/cvut/kbss/study/persistence/FormGenPersistenceFactory.java @@ -6,7 +6,6 @@ import jakarta.annotation.PreDestroy; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; import java.util.HashMap; @@ -15,7 +14,7 @@ import static cz.cvut.kbss.jopa.model.JOPAPersistenceProperties.CACHE_ENABLED; import static cz.cvut.kbss.jopa.model.JOPAPersistenceProperties.DATA_SOURCE_CLASS; import static cz.cvut.kbss.jopa.model.JOPAPersistenceProperties.ONTOLOGY_PHYSICAL_URI_KEY; -import static cz.cvut.kbss.study.util.ConfigParam.DRIVER; +import static cz.cvut.kbss.study.util.ConfigParam.PERSISTENCE_DRIVER; import static cz.cvut.kbss.study.util.ConfigParam.FORM_GEN_REPOSITORY_URL; @Configuration @@ -38,7 +37,7 @@ public EntityManagerFactory getEntityManagerFactory() { private void init() { final Map properties = new HashMap<>(PersistenceFactory.getDefaultParams()); properties.put(ONTOLOGY_PHYSICAL_URI_KEY, environment.getProperty(FORM_GEN_REPOSITORY_URL.toString())); - properties.put(DATA_SOURCE_CLASS, environment.getProperty(DRIVER.toString())); + properties.put(DATA_SOURCE_CLASS, environment.getProperty(PERSISTENCE_DRIVER.toString())); properties.put(CACHE_ENABLED, Boolean.FALSE.toString()); this.emf = Persistence.createEntityManagerFactory("formGenPU", properties); } diff --git a/src/main/java/cz/cvut/kbss/study/persistence/PersistenceFactory.java b/src/main/java/cz/cvut/kbss/study/persistence/PersistenceFactory.java index 6c70eec..085ec92 100644 --- a/src/main/java/cz/cvut/kbss/study/persistence/PersistenceFactory.java +++ b/src/main/java/cz/cvut/kbss/study/persistence/PersistenceFactory.java @@ -22,7 +22,7 @@ import static cz.cvut.kbss.jopa.model.JOPAPersistenceProperties.SCAN_PACKAGE; import static cz.cvut.kbss.ontodriver.config.OntoDriverProperties.DATA_SOURCE_PASSWORD; import static cz.cvut.kbss.ontodriver.config.OntoDriverProperties.DATA_SOURCE_USERNAME; -import static cz.cvut.kbss.study.util.ConfigParam.DRIVER; +import static cz.cvut.kbss.study.util.ConfigParam.PERSISTENCE_DRIVER; import static cz.cvut.kbss.study.util.ConfigParam.REPOSITORY_URL; /** @@ -54,7 +54,7 @@ public EntityManagerFactory getEntityManagerFactory() { private void init() { final Map properties = new HashMap<>(DEFAULT_PARAMS); properties.put(ONTOLOGY_PHYSICAL_URI_KEY, environment.getProperty(REPOSITORY_URL.toString())); - properties.put(DATA_SOURCE_CLASS, environment.getProperty(DRIVER.toString())); + properties.put(DATA_SOURCE_CLASS, environment.getProperty(PERSISTENCE_DRIVER.toString())); if (environment.getProperty(USERNAME_PROPERTY) != null) { properties.put(DATA_SOURCE_USERNAME, environment.getProperty(USERNAME_PROPERTY)); properties.put(DATA_SOURCE_PASSWORD, environment.getProperty(PASSWORD_PROPERTY)); diff --git a/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java b/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java index 80c1c3f..0f257ba 100644 --- a/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java +++ b/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java @@ -5,7 +5,7 @@ public enum ConfigParam { SECURITY_SAME_SITE("security.sameSite"), REPOSITORY_URL("repositoryUrl"), - DRIVER("driver"), + PERSISTENCE_DRIVER("persistenceDriver"), FORM_GEN_REPOSITORY_URL("formGenRepositoryUrl"), FORM_GEN_SERVICE_URL("formGenServiceUrl"), diff --git a/src/main/java/cz/cvut/kbss/study/util/Configuration.java b/src/main/java/cz/cvut/kbss/study/util/Configuration.java index 196ffbf..48a6579 100644 --- a/src/main/java/cz/cvut/kbss/study/util/Configuration.java +++ b/src/main/java/cz/cvut/kbss/study/util/Configuration.java @@ -11,9 +11,9 @@ public class Configuration { String appContext; /** - * Driver to manage triple stores + * Persistence driver to manage triple stores */ - String driver; + String persistenceDriver; /** * URL of repository that holds main data of the application @@ -43,12 +43,12 @@ public void setAppContext(String appContext) { this.appContext = appContext; } - public String getDriver() { - return driver; + public String getPersistenceDriver() { + return persistenceDriver; } - public void setDriver(String driver) { - this.driver = driver; + public void setPersistenceDriver(String persistenceDriver) { + this.persistenceDriver = persistenceDriver; } public String getRepositoryUrl() { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index c829826..488d3b8 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -2,7 +2,7 @@ server.servlet.context-path=/record-manager management.endpoints.web.exposure.include=health # Driver to manage triple stores -driver=cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource +persistenceDriver=cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource # URL of repository that holds main data of the application repositoryUrl=http://localhost:7200/repositories/record-manager-app # URL of repository where output and configuration of form-generator should be held diff --git a/src/test/java/cz/cvut/kbss/study/persistence/TestFormGenPersistenceFactory.java b/src/test/java/cz/cvut/kbss/study/persistence/TestFormGenPersistenceFactory.java index 0e8df28..5cdf8c3 100644 --- a/src/test/java/cz/cvut/kbss/study/persistence/TestFormGenPersistenceFactory.java +++ b/src/test/java/cz/cvut/kbss/study/persistence/TestFormGenPersistenceFactory.java @@ -21,7 +21,7 @@ public class TestFormGenPersistenceFactory { private static final String URL_PROPERTY = "test." + ConfigParam.FORM_GEN_REPOSITORY_URL; - private static final String DRIVER_PROPERTY = "test." + ConfigParam.DRIVER; + private static final String DRIVER_PROPERTY = "test." + ConfigParam.PERSISTENCE_DRIVER; @Autowired private Environment environment; diff --git a/src/test/java/cz/cvut/kbss/study/persistence/TestPersistenceFactory.java b/src/test/java/cz/cvut/kbss/study/persistence/TestPersistenceFactory.java index 0f36b12..9510fde 100644 --- a/src/test/java/cz/cvut/kbss/study/persistence/TestPersistenceFactory.java +++ b/src/test/java/cz/cvut/kbss/study/persistence/TestPersistenceFactory.java @@ -29,7 +29,7 @@ public class TestPersistenceFactory { private static final String URL_PROPERTY = "test." + ConfigParam.REPOSITORY_URL; - private static final String DRIVER_PROPERTY = "test." + ConfigParam.DRIVER; + private static final String DRIVER_PROPERTY = "test." + ConfigParam.PERSISTENCE_DRIVER; private static final String USERNAME_PROPERTY = "test.username"; private static final String PASSWORD_PROPERTY = "test.password"; diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 453a5f1..00a0e2d 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -1,11 +1,6 @@ test.repositoryUrl=study-test-repository -test.driver=cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource +test.persistenceDriver=cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource test.formGenRepositoryUrl=test-formGen-repository - repositoryUrl=study-test-repository - -driver=cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource - -formGenRepositoryUrl=test-formGen-repositor\ - y +formGenRepositoryUrl=test-formGen-repository formGenServiceUrl=http://localhost:8081/formGenerator \ No newline at end of file From af6562efee08613299f41ff06f87dec9eedce576 Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Mon, 2 Dec 2024 09:33:00 +0100 Subject: [PATCH 11/11] [#80] Remove configuration table from README.md --- README.md | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/README.md b/README.md index 57c9431..16c8f36 100644 --- a/README.md +++ b/README.md @@ -18,36 +18,6 @@ The system can be split into two parts. __Main application__ provides management The table lists environment variables that can be passed to the Record Manager backend through `docker-compose.yml`, an [env_file](https://docs.docker.com/compose/compose-file/compose-file-v3/#env_file), or the command line. For more details, see the [Configuration documentation](./doc/configuration.md). -| Variable | Description | -| --- | --- | -| ```APPCONTEXT``` | Public URL of the frontend of record-manager application that is used for password reset emails. e.g. https://study.example.com/record-manager/ (must have "/" at the end) | -| ```DRIVER``` | Driver to manage triple stores | -| ```EMAIL_BCC``` | Email addresses to be blind carbon-copied, separated by a comma (optional, can be empty). | -| ```EMAIL_CC``` | Email addresses to be carbon-copied, separated by a comma (optional, can be empty). | -| ```EMAIL_DISPLAYNAME``` | Email display name | -| ```EMAIL_FROM``` | if email.from is not entered, smtp.user is used instead | -| ```EMAIL_INVITATIONCONTENT``` | UserInvite email html content, variables: username, link, name, appContext | -| ```EMAIL_INVITATIONSUBJECT``` | serInvite email subject | -| ```EMAIL_PASSWORDCHANGECONTENT``` | PasswordReset email html content, variables: username, appContext | -| ```EMAIL_PASSWORDCHANGESUBJECT``` | Password change email | -| ```EMAIL_PASSWORDRESETCONTENT``` | PasswordReset email html content, variables: username, link, appContext | -| ```EMAIL_PASSWORDRESETSUBJECT``` | You can use variables in email contents by using {{variable}}, available variables are listed before email content property
Password Reset email subject | -| ```EMAIL_PROFILEUPDATECONTENT``` | PasswordReset email html content, variables: username, appContext | -| ```EMAIL_PROFILEUPDATESUBJECT``` | Profile update email | -| ```EMAIL_REPLYTO``` | Email cc addresses where all invitations will be sent. For more use delimiter "," (can remain empty) | -| ```FORMGENREPOSITORYURL``` | URL of repository where output and configuration of form-generator should be held | -| ```FORMGENSERVICEURL``` | REST endpoint of form generator service | -| ```RECORDS_ALLOWEDREJECTREASON``` | it indicates functionality allowing users to specify a reason for rejection is enabled. | -| ```REPOSITORYURL``` | URL of repository that holds main data of the application | -| ```SECURITY_CORD_ALLOWEDORIGINS``` | Configures allowed origins for CORS (e.g. http://localhost:3000). Use a comma to separate multiple values | -| ```SECURITY_OIDC_ROLECLAIM``` | Claim containing user roles in the OIDC access token (applies only when 'oidc' security provider is selected). Use
dot notation for nested objects | -| ```SECURITY_PROVIDER``` | Provider of application security. Possible values are 'internal' for internally stored users and 'oidc' for using an
OIDC-compatible authentication service. Its URL is configured via Spring Boot configuration parameters | -| ```SECURITY_SAMESITE``` | Option to pass sameSite attribute for set-cookie headers. Possible values are None,Lax,Strict. In case of None value also attribute "Secure;" is added. | -| ```SMTP_HOST``` | SMTP host | -| ```SMTP_PASSWORD``` | SMTP password | -| ```SMTP_PORT``` | SMTP port | -| ```SMTP_USER``` | SMTP user | - ## Documentation Build configuration and deployment are described in [Setup Guide](doc/setup.md).