diff --git a/charts/plugin-br-payments/README.md b/charts/plugin-br-payments/README.md index 1b9e359b0..ae1ce527e 100644 --- a/charts/plugin-br-payments/README.md +++ b/charts/plugin-br-payments/README.md @@ -56,8 +56,7 @@ The chart **fails fast** on `helm install` if any of the following are missing: | `app.configmap.OUTBOX_ENABLED` | Must be `"true"`. The plugin only registers HTTP routes when the outbox is enabled. | | `app.configmap.BTG_API_BASE_URL` | BTG API base URL. | | `app.configmap.BTG_AUTH_URL` | BTG OAuth2 token URL. | -| `app.configmap.MIDAZ_ONBOARDING_URL` | Midaz onboarding service URL. | -| `app.configmap.MIDAZ_TRANSACTION_URL` | Midaz transaction service URL. | +| `app.configmap.MIDAZ_LEDGER_URL` | Midaz Ledger service URL (single plane). The deprecated `MIDAZ_ONBOARDING_URL` + `MIDAZ_TRANSACTION_URL` pair is still accepted as a fallback. | | `app.secrets.BTG_CLIENT_ID` | BTG OAuth2 client ID. | | `app.secrets.BTG_CLIENT_SECRET` | BTG OAuth2 client secret. | | `app.secrets.BTG_WEBHOOK_SECRET` | Bearer token for incoming BTG webhooks. | diff --git a/charts/plugin-br-payments/templates/NOTES.txt b/charts/plugin-br-payments/templates/NOTES.txt index 3f43eb57d..906e89e58 100644 --- a/charts/plugin-br-payments/templates/NOTES.txt +++ b/charts/plugin-br-payments/templates/NOTES.txt @@ -46,8 +46,7 @@ The following values MUST be set for the deployment to start successfully: - app.configmap.OUTBOX_ENABLED (must be "true" — HTTP routes only register when the outbox is enabled) - app.configmap.BTG_API_BASE_URL (BTG API base URL) - app.configmap.BTG_AUTH_URL (BTG OAuth2 token URL) - - app.configmap.MIDAZ_ONBOARDING_URL (Midaz onboarding service URL) - - app.configmap.MIDAZ_TRANSACTION_URL (Midaz transaction service URL) + - app.configmap.MIDAZ_LEDGER_URL (Midaz Ledger service URL; deprecated MIDAZ_ONBOARDING_URL + MIDAZ_TRANSACTION_URL pair still accepted as a fallback) - app.secrets.BTG_CLIENT_ID (BTG OAuth2 client ID) - app.secrets.BTG_CLIENT_SECRET (BTG OAuth2 client secret) - app.secrets.BTG_WEBHOOK_SECRET (BTG webhook bearer token) diff --git a/charts/plugin-br-payments/templates/_helpers.tpl b/charts/plugin-br-payments/templates/_helpers.tpl index f44e058c1..1a616af3d 100644 --- a/charts/plugin-br-payments/templates/_helpers.tpl +++ b/charts/plugin-br-payments/templates/_helpers.tpl @@ -181,13 +181,17 @@ plugin-br-payments README. {{- fail "\n\nERROR: app.secrets.BTG_WEBHOOK_SECRET is REQUIRED.\n Set the BTG webhook bearer token in the secrets section.\n" }} {{- end }} -{{/* Midaz Ledger URLs — required for production */}} -{{- if not .Values.app.configmap.MIDAZ_ONBOARDING_URL }} -{{- fail "\n\nERROR: app.configmap.MIDAZ_ONBOARDING_URL is REQUIRED.\n Set the Midaz onboarding service URL.\n" }} +{{/* Midaz Ledger URL — required for production. + Preferred: app.configmap.MIDAZ_LEDGER_URL (single Ledger plane URL; the + app now serves onboarding + transaction from one plane). + DEPRECATED fallback: MIDAZ_ONBOARDING_URL + MIDAZ_TRANSACTION_URL (the + former split pair). Still accepted for backward compatibility with + environments that have not migrated yet; remove once all overlays use + MIDAZ_LEDGER_URL. */}} +{{- if not .Values.app.configmap.MIDAZ_LEDGER_URL }} +{{- if not (and .Values.app.configmap.MIDAZ_ONBOARDING_URL .Values.app.configmap.MIDAZ_TRANSACTION_URL) }} +{{- fail "\n\nERROR: app.configmap.MIDAZ_LEDGER_URL is REQUIRED.\n Set the Midaz Ledger service URL.\n (Deprecated: the former MIDAZ_ONBOARDING_URL + MIDAZ_TRANSACTION_URL pair is still accepted as a fallback.)\n" }} {{- end }} - -{{- if not .Values.app.configmap.MIDAZ_TRANSACTION_URL }} -{{- fail "\n\nERROR: app.configmap.MIDAZ_TRANSACTION_URL is REQUIRED.\n Set the Midaz transaction service URL.\n" }} {{- end }} {{/* PostgreSQL password is single-sourced from the postgresql subchart Secret diff --git a/charts/plugin-br-payments/templates/bootstrap-postgres.yaml b/charts/plugin-br-payments/templates/bootstrap-postgres.yaml index 0d85342e0..b257903de 100644 --- a/charts/plugin-br-payments/templates/bootstrap-postgres.yaml +++ b/charts/plugin-br-payments/templates/bootstrap-postgres.yaml @@ -94,10 +94,10 @@ spec: DB_EXISTS=0 ROLE_EXISTS=0 - if PGPASSWORD="$DB_ADMIN_PASSWORD" psql -At -v ON_ERROR_STOP=1 -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER_ADMIN" -d "$DB_DATABASE" -c "SELECT 1 FROM pg_database WHERE datname='$APP_DB'" | grep -q 1; then + if PGPASSWORD="$DB_ADMIN_PASSWORD" psql -At -v ON_ERROR_STOP=1 -v db="$APP_DB" -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER_ADMIN" -d "$DB_DATABASE" -c "SELECT 1 FROM pg_database WHERE datname=:'db'" | grep -q 1; then DB_EXISTS=1 fi - if PGPASSWORD="$DB_ADMIN_PASSWORD" psql -At -v ON_ERROR_STOP=1 -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER_ADMIN" -d "$DB_DATABASE" -c "SELECT 1 FROM pg_roles WHERE rolname='$APP_ROLE'" | grep -q 1; then + if PGPASSWORD="$DB_ADMIN_PASSWORD" psql -At -v ON_ERROR_STOP=1 -v role="$APP_ROLE" -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER_ADMIN" -d "$DB_DATABASE" -c "SELECT 1 FROM pg_roles WHERE rolname=:'role'" | grep -q 1; then ROLE_EXISTS=1 fi diff --git a/charts/plugin-br-payments/values-template.yaml b/charts/plugin-br-payments/values-template.yaml index 141d5798c..9423ec5d0 100644 --- a/charts/plugin-br-payments/values-template.yaml +++ b/charts/plugin-br-payments/values-template.yaml @@ -35,9 +35,9 @@ app: # BTG Provider integration (REQUIRED) BTG_API_BASE_URL: "" BTG_AUTH_URL: "" - # Midaz Ledger (REQUIRED) - MIDAZ_ONBOARDING_URL: "" - MIDAZ_TRANSACTION_URL: "" + # Midaz Ledger (REQUIRED) — single Ledger plane URL. The deprecated + # MIDAZ_ONBOARDING_URL + MIDAZ_TRANSACTION_URL pair is still accepted. + MIDAZ_LEDGER_URL: "" # Auth PLUGIN_AUTH_ENABLED: "true" PLUGIN_AUTH_ADDRESS: "" diff --git a/charts/plugin-br-payments/values.yaml b/charts/plugin-br-payments/values.yaml index 3e81c8316..925ccc49b 100644 --- a/charts/plugin-br-payments/values.yaml +++ b/charts/plugin-br-payments/values.yaml @@ -238,9 +238,10 @@ app: BTG_API_BASE_URL: "" BTG_AUTH_URL: "" BTG_TOKEN_REFRESH_INTERVAL: "1h" - # Midaz Ledger URLs (REQUIRED for production - validated by helper) - MIDAZ_ONBOARDING_URL: "" - MIDAZ_TRANSACTION_URL: "" + # Midaz Ledger URL (REQUIRED for production - validated by helper). + # Single Ledger plane URL; the deprecated MIDAZ_ONBOARDING_URL + + # MIDAZ_TRANSACTION_URL pair is still accepted as a fallback. + MIDAZ_LEDGER_URL: "" # Reconciliation worker (in-process) RECONCILIATION_INTERVAL: "5m" RECONCILIATION_LOOKBACK_HOURS: "24"