Skip to content

Commit

Permalink
#2270: Adding comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DarioGii committed Dec 20, 2024
1 parent 290d5b3 commit fd0159d
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public DatabaseConfig(@Autowired ApplicationProperties applicationProperties) {
this.applicationProperties = applicationProperties;
}

/**
* Creates the <code>DataSource</code> for the connection to the DB. If the active profile is set to <em>'default'</em> it will use
* local configiration, namely using localhost as the host for the connection. If set to <em>'docker'</em> it will use
* the Dokcer server configuration.
* */
@Bean
public DataSource dataSource() {
ApplicationProperties.System system = applicationProperties.getSystem();
Expand Down Expand Up @@ -57,6 +62,9 @@ public Connection connection() throws SQLException {
return dataSource().getConnection();
}

/**
* Changes the DB connection URL based on the active profile selected (<em>'default'</em> | <em>'docker'</em>).
* */
private String getDefaultProfileUrl(ApplicationProperties.Datasource datasource) {
String localUrl =
datasource
Expand All @@ -69,6 +77,9 @@ private String getDefaultProfileUrl(ApplicationProperties.Datasource datasource)
return localUrl;
}

/**
* Selects the DB driver based on the <code>stirling.software.SPDF.model.Driver</code> chosen.
* */
private String getDriverClassName(ApplicationProperties.Driver driverName) {
switch (driverName) {
case ORACLE -> {
Expand Down

0 comments on commit fd0159d

Please sign in to comment.