Skip to content

Commit

Permalink
CIV-00000 Add environment variable for data migration (#2992)
Browse files Browse the repository at this point in the history
  • Loading branch information
dharmendrak authored Sep 20, 2024
1 parent e3979b9 commit 0df22bc
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/cmc-claim-store/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: cmc-claim-store
home: https://github.com/hmcts/cmc-claim-store
version: 4.1.55
version: 4.1.56
description: Helm chart for the HMCTS CMC Claim-Store service
# be aware when bumping version that it is used elsewhere, e.g.:
# chart-cmc - demo: https://github.com/hmcts/chart-cmc/tree/master/cmc
Expand Down
1 change: 1 addition & 0 deletions charts/cmc-claim-store/values.aat.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ java:
SCHEDULE_TRANSFER_CLAIMS: '0 0 12 1 * ?'
OIDC_ISSUER: https://forgerock-am.service.core-compute-idam-aat2.internal:8443/openam/oauth2/realms/root/realms/hmcts
USER_TOKEN_CACHE_ENABLED: true
REFERENCE_DATABASE_MIGRATION: true
1 change: 1 addition & 0 deletions charts/cmc-claim-store/values.preview.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ java:
CMC_DB_USERNAME: "{{ .Values.postgresql.auth.username}}"
CMC_DB_PASSWORD: "{{ .Values.postgresql.auth.password}}"
CMC_DB_CONNECTION_OPTIONS: '?sslmode=allow'
REFERENCE_DATABASE_MIGRATION: true
CORE_CASE_DATA_API_URL: http://${SERVICE_NAME}-ccd-data-store-api
OIDC_ISSUER: https://forgerock-am.service.core-compute-idam-aat2.internal:8443/openam/oauth2/realms/root/realms/hmcts
RPA_NOTIFICATIONS_LEGALSEALEDCLAIMRECIPIENT: civilmoneyclaims+rpa-legal-sealedclaim-issued@gmail.com
Expand Down
1 change: 1 addition & 0 deletions charts/cmc-claim-store/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,5 @@ java:
COURT_FINDER_API_URL: http://fact-api-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal
MANAGEMENT_HEALTH_MAIL_ENABLED: false
SPRING_CLOUD_BOOTSTRAP_ENABLED: true
REFERENCE_DATABASE_MIGRATION: true
DOCUMENT_MANAGEMENT_SECURED: true
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.flywaydb.core.Flyway;
import org.skife.jdbi.v2.DBI;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
Expand All @@ -19,6 +20,10 @@
@Configuration
@ConfigurationProperties
public class CmcDBConfiguration {

@Value("${spring.flyway.enabled}")
private Boolean flywayEnabled;

@Bean
@Primary
@ConfigurationProperties("spring.datasource")
Expand All @@ -39,7 +44,9 @@ public TransactionAwareDataSourceProxy transactionAwareDataSourceProxy(
) {
TransactionAwareDataSourceProxy dataSourceProxy = new TransactionAwareDataSourceProxy(dataSource);

migrateFlyway(dataSourceProxy);
if (flywayEnabled) {
migrateFlyway(dataSourceProxy);
}
return dataSourceProxy;
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ spring:
oidc:
client-id: internal
client-secret: internal
flyway:
enabled: ${REFERENCE_DATABASE_MIGRATION:true}

oidc:
issuer: ${OIDC_ISSUER:http://fr-am:8080/openam/oauth2/hmcts}
Expand Down

0 comments on commit 0df22bc

Please sign in to comment.