Skip to content

Commit

Permalink
also remove db.user and db.password
Browse files Browse the repository at this point in the history
  • Loading branch information
nr23730 committed Jan 12, 2024
1 parent ec240c1 commit f4401d3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/mskcc/cbio/portal/dao/JdbcDataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/org/mskcc/cbio/portal/util/DatabaseProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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"));

Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/scripts/hotDeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/scripts/importUsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 5 additions & 3 deletions src/main/resources/scripts/importer/cbioportal_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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])


Expand Down

0 comments on commit f4401d3

Please sign in to comment.