Skip to content

Commit

Permalink
[#75] Refactor property configuration to application.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
palagdan committed Oct 9, 2024
1 parent 01887c8 commit 42e9280
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.springframework.context.annotation.PropertySource;

@SpringBootApplication
@PropertySource("classpath:config.properties")
public class RecordManagerApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static cz.cvut.kbss.study.util.ConfigParam.FORM_GEN_REPOSITORY_URL;

@Configuration
@PropertySource("classpath:config.properties")
public class FormGenPersistenceFactory {

private final Environment environment;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/cz/cvut/kbss/study/util/ConfigParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public enum ConfigParam {
E_PROFILE_UPDATE_SUBJECT("email.profileUpdateSubject"),
E_PROFILE_UPDATE_CONTENT("email.profileUpdateContent"),

SECURITY_PROVIDER("security.provider"),

OIDC_ROLE_CLAIM("oidc.roleClaim"),

CORS_ALLOWED_ORIGINS("cors.allowedOrigins");
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/application.properties

This file was deleted.

66 changes: 66 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
server:
servlet:
context-path: /record-manager

# Driver to manage triple stores
driver: 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
formGenRepositoryUrl: http://localhost:7200/repositories/record-manager-formgen

# REST endpoint of form generator service
formGenServiceUrl: "http://localhost:8080/s-pipes/service?_pId=transform&sgovRepositoryUrl=https%3A%2F%2Fgraphdb.onto.fel.cvut.cz%2Frepositories%2Fkodi-slovnik-gov-cz"

# 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.
security:
sameSite: ""

# Provider of application security
provider: internal

# Url of the website for password reset emails (must have "/" at the end)
appContext: http://localhost:3000/record-manager

# SMTP configuration
smtp:
host: smtp.gmail.com
port: 587
user: [email protected]
password: AdminOrganization123

# Email settings
email:
displayName: Record Manager
from: ""
replyTo: ""
cc: ""
bcc: ""

# Password Reset email configuration
passwordResetSubject: Password Reset
passwordResetContent: "<div><p>Dear user {{username}}, </p><p>please set your new password here: {{link}} </p><p>Best regards, <br>StudyManager</p></div>"

# User Invite email configuration
invitationSubject: Welcome to study
invitationContent: "<div><p>Dear {{name}}, </p><p>you have been invited to a study running at {{appContext}}. </p><p>Your username is: {{username}}. </p>\
<p>Please set your password here: {{link}} </p><p>Best regards, <br>StudyManager</p></div>"

# Password Change email configuration
passwordChangeSubject: Password Change
passwordChangeContent: "<div><p>Dear user {{username}}, </p><p>your password has been changed. </p><p>Best regards, <br>RecordManager</p></div>"

# Profile Update email configuration
profileUpdateSubject: Profile updated by a study coordinator
profileUpdateContent: "<div><p>Dear user {{username}}, </p><p>your profile at {{appContext}} has been updated by a study coordinator. </p><p>Best regards, <br>RecordManager</p></div>"

# Claim containing user roles in the OIDC access token
oidc:
roleClaim: realm_access.roles

# Configures allowed origins for CORS
cors:
allowedOrigins: ""
64 changes: 0 additions & 64 deletions src/main/resources/config.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.springframework.core.env.Environment;

@Configuration
@PropertySource("classpath:config.properties")
@Profile("test")
public class TestFormGenPersistenceFactory {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static cz.cvut.kbss.ontodriver.config.OntoDriverProperties.DATA_SOURCE_USERNAME;

@Configuration
@PropertySource("classpath:config.properties")
@Profile("test")
public class TestPersistenceFactory {

Expand Down
10 changes: 10 additions & 0 deletions src/test/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
test:
repositoryUrl: study-test-repository
driver: cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource
formGenRepositoryUrl: test-formGen-repository

repositoryUrl: study-test-repository

formGenRepositoryUrl: test-formGen-repository

formGenServiceUrl: http://localhost:8081/formGenerator
7 changes: 0 additions & 7 deletions src/test/resources/config.properties

This file was deleted.

0 comments on commit 42e9280

Please sign in to comment.