From 17391120ffbd1868af57af6d8bad974a86c4bcb2 Mon Sep 17 00:00:00 2001 From: Ioannis Kalyvas Date: Tue, 9 Oct 2018 16:20:45 +0300 Subject: [PATCH] Alter Application Configuration to Support Profile based Configuration --- .../DevelDatabaseConfiguration.java | 6 +- .../ProductionDatabaseConfiguration.java | 6 +- .../resources/application-devel.properties | 21 +++++ .../application-production.properties | 21 +++++ .../src/main/resources/application.properties | 93 ++++++++----------- 5 files changed, 89 insertions(+), 58 deletions(-) create mode 100644 dmp-backend/web/src/main/resources/application-devel.properties create mode 100644 dmp-backend/web/src/main/resources/application-production.properties diff --git a/dmp-backend/web/src/main/java/eu/eudat/configurations/DevelDatabaseConfiguration.java b/dmp-backend/web/src/main/java/eu/eudat/configurations/DevelDatabaseConfiguration.java index 64ddf8b49..7227b8a69 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/configurations/DevelDatabaseConfiguration.java +++ b/dmp-backend/web/src/main/java/eu/eudat/configurations/DevelDatabaseConfiguration.java @@ -45,9 +45,9 @@ public class DevelDatabaseConfiguration { public DataSource dataSource() { return DataSourceBuilder .create() - .username(env.getProperty("devel.database.username")) - .password(env.getProperty("devel.database.password")) - .url(env.getProperty("devel.database.url")) + .username(env.getProperty("database.username")) + .password(env.getProperty("database.password")) + .url(env.getProperty("database.url")) .driverClassName(env.getProperty("database.driver-class-name")) .build(); } diff --git a/dmp-backend/web/src/main/java/eu/eudat/configurations/ProductionDatabaseConfiguration.java b/dmp-backend/web/src/main/java/eu/eudat/configurations/ProductionDatabaseConfiguration.java index 33ad27a08..ab9405841 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/configurations/ProductionDatabaseConfiguration.java +++ b/dmp-backend/web/src/main/java/eu/eudat/configurations/ProductionDatabaseConfiguration.java @@ -47,9 +47,9 @@ public class ProductionDatabaseConfiguration { public DataSource dataSource() { DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName(env.getProperty("database.driver-class-name")); - dataSource.setUrl(env.getProperty("production.database.url")); - dataSource.setUsername(env.getProperty("production.database.username")); - dataSource.setPassword(env.getProperty("production.database.password")); + dataSource.setUrl(env.getProperty("database.url")); + dataSource.setUsername(env.getProperty("database.username")); + dataSource.setPassword(env.getProperty("database.password")); return dataSource; } diff --git a/dmp-backend/web/src/main/resources/application-devel.properties b/dmp-backend/web/src/main/resources/application-devel.properties new file mode 100644 index 000000000..701d3520a --- /dev/null +++ b/dmp-backend/web/src/main/resources/application-devel.properties @@ -0,0 +1,21 @@ +dmp.domain = http://localhost:4200 + +####################PERSISTENCE OVERRIDES CONFIGURATIONS########## +database.url=jdbc:postgresql://localhost:32768/dmptool +database.username=postgres +database.password= + +####################ELASTIIC SEARCH TAGS OVERRIDES CONFIGURATIONS########## +elasticsearch.host = localhost +elasticsearch.port = 9200 + +####################ELK OVERRIDES CONFIGURATIONS########## +http-logger.server-address = http://localhost:31311 + +####################PDF OVERRIDES CONFIGURATIONS########## +pdf.converter.url=http://localhost/ + +####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS########## +configuration.externalUrls=/tmp/ExternalUrls.xml +configuration.dynamicProjectUrl=/tmp/ProjectConfiguration.xml +configuration.h2020template=/tmp/h2020.docx \ No newline at end of file diff --git a/dmp-backend/web/src/main/resources/application-production.properties b/dmp-backend/web/src/main/resources/application-production.properties new file mode 100644 index 000000000..8d7b9287e --- /dev/null +++ b/dmp-backend/web/src/main/resources/application-production.properties @@ -0,0 +1,21 @@ +dmp.domain = http://devel.opendmp.eu + +####################PERSISTENCE OVERRIDES CONFIGURATIONS########## +database.url=jdbc:postgresql://develdb1.madgik.di.uoa.gr:5432/dmptool +database.username=dmptool +database.password=dmpt00lu$r + +####################ELASTIIC SEARCH TAGS OVERRIDES CONFIGURATIONS########## +elasticsearch.host = tags-elastic-search +elasticsearch.port = 9200 + +####################ELK OVERRIDES CONFIGURATIONS########## +http-logger.server-address = http://logstash:31311 + +####################PDF OVERRIDES CONFIGURATIONS########## +pdf.converter.url=http://docsbox-web/ + +####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS########## +configuration.externalUrls=/tmp/ExternalUrls.xml +configuration.dynamicProjectUrl=/tmp/ProjectConfiguration.xml +configuration.h2020template=/tmp/h2020.docx \ No newline at end of file diff --git a/dmp-backend/web/src/main/resources/application.properties b/dmp-backend/web/src/main/resources/application.properties index a0cd4305b..b1aab715d 100644 --- a/dmp-backend/web/src/main/resources/application.properties +++ b/dmp-backend/web/src/main/resources/application.properties @@ -1,28 +1,16 @@ -##########################Security########################################## -#eu.eudat.logic.security.portmapping.http = 7081 -#eu.eudat.logic.security.portmapping.https = 7444 -########################/Security######################################## server.port=8080 server.tomcat.max-threads = 20 server.tomcat.max-connections = 10000 logging.file=/logs/spring-boot-logging.log -##########################Persistence########################################## -database.driver-class-name=org.postgresql.Driver -devel.database.url=jdbc:postgresql://localhost:32768/dmptool -devel.database.username=postgres -devel.database.password= -production.database.url=jdbc:postgresql://develdb1.madgik.di.uoa.gr:5432/dmptool -production.database.username=dmptool -production.database.password=dmpt00lu$r -##########################/Persistence########################################## -###################Allowed Proxy Service Host ############################ +spring.profiles.active=devel eu.eudat.logic.proxy.allowed.host=https://eestore.paas2.uninett.no -configuration.externalUrls=/tmp/ExternalUrls.xml -configuration.dynamicProjectUrl=/tmp/ProjectConfiguration.xml -configuration.h2020template=/tmp/h2020.docx -####################################################### -########################/Email############################# +####################INVITATION MAIL CONFIGURATIONS############## +####################GENERIC MAIL CONFIGURATIONS################# +mail.subject=Invitation to DMP Plan {dmpname} +mail.from=citesagrdev@gmail.com + +####################SPRING MAIL CONFIGURATIONS################# spring.mail.default-encoding=UTF-8 spring.mail.host=smtp.gmail.com spring.mail.username=citesagrdev@gmail.com @@ -32,54 +20,55 @@ spring.mail.protocol=smtp spring.mail.test-connection=false spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true -mail.subject=Invitation to DMP Plan {dmpname} -mail.content=You have been invited to {dmpname} data management plan.Follow the link http://dl043.madgik.di.uoa.gr/dmps/invitation/{invitationID} to submit it -mail.from=citesagrdev@gmail.com -########################FACEBOOK LOGIN Properties############################# -facebook.login.clientId=110586756143149 -facebook.login.clientSecret=522a847f05c873d0222c85109e24f55a -facebook.login.namespace=eudat -########################GOOGLE LOGIN Properties############################# -google.login.clientId=524432312250-sc9qsmtmbvlv05r44onl6l93ia3k9deo.apps.googleusercontent.com -########################LINKEDIN LOGIN Properties#############################HiR4hQH9HNubKC5iKQy0l4mAZ -linkedin.login.clientId=86bl8vfk77clh9 -linkedin.login.clientSecret=2OCO9e3wKylW05Tt -linkedin.login.redirect_uri=http://opendmp.eu/login/linkedin -########################LINKEDIN LOGIN Properties############################# -twitter.login.clientId=HiR4hQH9HNubKC5iKQy0l4mAZ -twitter.login.clientSecret=9KZHgkqUO2QFnELSL14jeUvfUacWX23rqD8OW8X0xoRDXOSfKH -twitter.login.redirect_uri=http://opendmp.eu/login/twitter -########################Persistence/Hibernate/Batch############################## -spring.profiles.active=devel -########################Persistence/Hibernate/Connection pool#################### + +#############LOGIN CONFIGURATIONS######### +#############GENERIC LOGIN CONFIGURATIONS######### autouser.root.email=root@dmp.com autouser.root.password=root autouser.root.username=root -################################################################################# + +#############FACEBOOK LOGIN CONFIGURATIONS######### +facebook.login.clientId=110586756143149 +facebook.login.clientSecret=522a847f05c873d0222c85109e24f55a +facebook.login.namespace=eudat + +#############GOOGLE LOGIN CONFIGURATIONS######### +google.login.clientId=524432312250-sc9qsmtmbvlv05r44onl6l93ia3k9deo.apps.googleusercontent.com + +#############LINKEDIN LOGIN CONFIGURATIONS######### +linkedin.login.clientId=86bl8vfk77clh9 +linkedin.login.clientSecret=2OCO9e3wKylW05Tt +linkedin.login.redirect_uri=http://opendmp.eu/login/linkedin + +#############TWITTER LOGIN CONFIGURATIONS######### +twitter.login.clientId=HiR4hQH9HNubKC5iKQy0l4mAZ +twitter.login.clientSecret=9KZHgkqUO2QFnELSL14jeUvfUacWX23rqD8OW8X0xoRDXOSfKH +twitter.login.redirect_uri=http://opendmp.eu/login/twitter + +#############B2 ACCESS CONFIGURATIONS######### b2access.externallogin.user_info_url=https://b2access-integration.fz-juelich.de:443/oauth2/userinfo b2access.externallogin.access_token_url=https://b2access-integration.fz-juelich.de:443/oauth2/token b2access.externallogin.redirect_uri=http://opendmp.eu/api/oauth/authorized/b2access b2access.externallogin.clientid=eudatdmptool b2access.externallogin.clientSecret=A3b*1*92 -################################################################################# -pdf.converter.url=http://docsbox-web/ + +#############FILE STORAGE CONFIGURATIONS######### files.storage.temp = temp files.storage.final = final -################################################################################# + +#############DYNAMIC PROJECT CONFIGURATIONS######### project.configuration.project.name = Project project.configuration.funder.name = Funder project.configuration.grant.name = Grant -################################################################################# + +#############HTTP LOGGER DELAY CONFIGURATIONS######### http-logger.initial-delay = 0 http-logger.delay = 10 -http-logger.server-address = http://logstash:31311 -#############################Elastic Search###################################### -elasticsearch.host = tags-elastic-search -elasticsearch.port = 9200 -############################ -dmp.domain = http://localhost:4200 -########################## -# Number of ms to wait before throwing an exception if no connection is available. + +##########################PERISTENCE########################################## +#############GENERIC DATASOURCE CONFIGURATIONS######### +database.driver-class-name=org.postgresql.Driver +#############SPRING DATASOURCE CONFIGURATIONS######### spring.datasource.maxIdle: 10 spring.datasource.max-active: 70 spring.datasource.max-wait: 10000