From f4401d36fe36716cbcb52ffdcc5d6d80b8600be7 Mon Sep 17 00:00:00 2001 From: Niklas Reimer Date: Fri, 12 Jan 2024 15:14:53 +0100 Subject: [PATCH] also remove db.user and db.password --- .../mskcc/cbio/portal/dao/JdbcDataSource.java | 4 ++-- .../cbio/portal/util/DatabaseProperties.java | 20 +++++++++++++++++++ src/main/resources/scripts/hotDeploy.py | 4 ++-- src/main/resources/scripts/importUsers.py | 4 ++-- .../scripts/importer/cbioportal_common.py | 8 +++++--- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/mskcc/cbio/portal/dao/JdbcDataSource.java b/src/main/java/org/mskcc/cbio/portal/dao/JdbcDataSource.java index d7f29f1a..de28d9f1 100644 --- a/src/main/java/org/mskcc/cbio/portal/dao/JdbcDataSource.java +++ b/src/main/java/org/mskcc/cbio/portal/dao/JdbcDataSource.java @@ -31,8 +31,8 @@ public JdbcDataSource () { "----------------------------------------------------------------------------------------------------------------\n" ); - Assert.hasText(userName, errorMessage("username", "db.user")); - Assert.hasText(password, errorMessage("password", "db.password")); + Assert.hasText(userName, errorMessage("username", "spring.datasource.username")); + Assert.hasText(password, errorMessage("password", "spring.datasource.password")); Assert.hasText(mysqlDriverClassName, errorMessage("driver class name", "spring.datasource.driver-class-name")); this.setUrl(connectionURL); diff --git a/src/main/java/org/mskcc/cbio/portal/util/DatabaseProperties.java b/src/main/java/org/mskcc/cbio/portal/util/DatabaseProperties.java index ba70bbf8..2ead5c7c 100644 --- a/src/main/java/org/mskcc/cbio/portal/util/DatabaseProperties.java +++ b/src/main/java/org/mskcc/cbio/portal/util/DatabaseProperties.java @@ -48,6 +48,8 @@ public class DatabaseProperties { private String dbUseSSL; private String dbEnablePooling; private String connectionURL; + private String springDbUser; + private String springDbPassword; private String springConnectionURL; private String springDbDriverClassName; @@ -67,6 +69,8 @@ public static DatabaseProperties getInstance() { dbProperties.setDbUseSSL(GlobalProperties.getProperty("db.use_ssl")); dbProperties.setDbEnablePooling(GlobalProperties.getProperty("db.enable_pooling")); dbProperties.setConnectionURL(GlobalProperties.getProperty("db.connection_string")); + dbProperties.setConnectionURL(GlobalProperties.getProperty("spring.datasource.username")); + dbProperties.setConnectionURL(GlobalProperties.getProperty("spring.datasource.password")); dbProperties.setConnectionURL(GlobalProperties.getProperty("spring.datasource.url")); dbProperties.setConnectionURL(GlobalProperties.getProperty("spring.datasource.driver-class-name")); @@ -157,6 +161,22 @@ public void setSpringConnectionURL(String springConnectionURL) { this.springConnectionURL = springConnectionURL; } + public String getSpringDbUser() { + return springDbUser; + } + + public void setSpringDbUser(String springDbUser) { + this.springDbUser = springDbUser; + } + + public String getSpringDbPassword() { + return springDbPassword; + } + + public void setSpringDbPassword(String springDbPassword) { + this.springDbPassword = springDbPassword; + } + public String getSpringDbDriverClassName() { return springDbDriverClassName; } diff --git a/src/main/resources/scripts/hotDeploy.py b/src/main/resources/scripts/hotDeploy.py index 27677898..634a8cfb 100755 --- a/src/main/resources/scripts/hotDeploy.py +++ b/src/main/resources/scripts/hotDeploy.py @@ -30,8 +30,8 @@ WAR_FILE_DEST = "/srv/www/sander-tomcat/tomcat6/webapps/" # fields in credentials - should match portal application.properties -CGDS_DATABASE_USER = 'db.user' -CGDS_DATABASE_PW = 'db.password' +CGDS_DATABASE_USER = 'spring.datasource.username' +CGDS_DATABASE_PW = 'spring.datasource.password' BITLY_USER = 'bitly.user' BITLY_KEY = 'bitly.api_key' CGDS_USERS_SPREADSHEET = 'users.spreadsheet' diff --git a/src/main/resources/scripts/importUsers.py b/src/main/resources/scripts/importUsers.py index 01d75884..01594cc7 100755 --- a/src/main/resources/scripts/importUsers.py +++ b/src/main/resources/scripts/importUsers.py @@ -52,9 +52,9 @@ OUTPUT_FILE = sys.stdout # fields in application.properties -CGDS_DATABASE_HOST = 'db.host' +CGDS_DATABASE_HOST = 'spring.datasource.password' CGDS_DATABASE_NAME = 'db.portal_db_name' -CGDS_DATABASE_USER = 'db.user' +CGDS_DATABASE_USER = 'spring.datasource.user' CGDS_DATABASE_PW = 'db.password' GOOGLE_ID = 'google.id' GOOGLE_PW = 'google.pw' diff --git a/src/main/resources/scripts/importer/cbioportal_common.py b/src/main/resources/scripts/importer/cbioportal_common.py index 6f486ccc..87431208 100644 --- a/src/main/resources/scripts/importer/cbioportal_common.py +++ b/src/main/resources/scripts/importer/cbioportal_common.py @@ -45,8 +45,10 @@ PORTAL_PROPERTY_DATABASE_NAME = 'db.portal_db_name' PORTAL_PROPERTY_DATABASE_URL = 'db.connection_string' PORTAL_PROPERTY_DATABASE_USESSL = 'db.use_ssl' +PORTAL_PROPERTY_SPRING_DATABASE_USER = 'spring.datasource.username' +PORTAL_PROPERTY_SPRING_DATABASE_PW = 'spring.datasource.password' PORTAL_PROPERTY_SPRING_DATABASE_URL = 'spring.datasource.url' -REQUIRED_DATABASE_PROPERTIES = [PORTAL_PROPERTY_DATABASE_USER, PORTAL_PROPERTY_DATABASE_PW, PORTAL_PROPERTY_SPRING_DATABASE_URL] +REQUIRED_DATABASE_PROPERTIES = [PORTAL_PROPERTY_SPRING_DATABASE_USER, PORTAL_PROPERTY_SPRING_DATABASE_PW, PORTAL_PROPERTY_SPRING_DATABASE_URL] # provides a key for data types to metafile specification dict. class MetaFileTypes(object): @@ -1054,8 +1056,8 @@ def get_database_properties(properties_filename: str) -> Optional[PortalProperti """, file=ERROR_FILE) return None - return PortalProperties(properties[PORTAL_PROPERTY_DATABASE_USER], - properties[PORTAL_PROPERTY_DATABASE_PW], + return PortalProperties(properties[PORTAL_PROPERTY_SPRING_DATABASE_USER], + properties[PORTAL_PROPERTY_SPRING_DATABASE_PW], properties[PORTAL_PROPERTY_SPRING_DATABASE_URL])