Skip to content

Commit d1145e1

Browse files
committed
chore: make KCM version configurable via environment variable
1 parent 0667fe1 commit d1145e1

6 files changed

Lines changed: 20 additions & 2 deletions

File tree

.envrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,14 @@
373373
"valueType": "url",
374374
"example": "https://viewer.kcmg.nl/",
375375
"developmentDefault": "https://viewer.kcmg.nl/"
376+
},
377+
{
378+
"name": "KCM_SURVEY_VERSION",
379+
"description": "Version of the KCM Survey widget to use (e.g., 'latest' or specific version number).",
380+
"required": false,
381+
"valueType": "string",
382+
"developmentDefault": "",
383+
"example": "v4.49"
376384
}
377385
]
378386
}

ENVIRONMENT_VARIABLES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
| `KCM_SURVEY_ID` | string | | | Survey ID for the KCM Survey widget, used to identify which survey to display. | `add-kcm-survey-id` | `` |
3030
| `KCM_SURVEY_STYLESHEETS_LINK` | url | | | URL for the custom stylesheet for the KCM Survey widget (e.g., https://www.utrecht.nl/fileadmin/kcm-radio.css). | `https://www.utrecht.nl` | `https://www.utrecht.nl` |
3131
| `KCM_SURVEY_URL` | url | | | Base URL for the KCM Survey service where the survey widget is hosted. | `https://viewer.kcmg.nl/` | `https://viewer.kcmg.nl/` |
32+
| `KCM_SURVEY_VERSION` | string | | | Version of the KCM Survey widget to use (e.g., 'latest' or specific version number). | `v4.49` | `` |
3233
| `MATOMO_CONTAINER_ID` | string | | | Container ID for the Matomo tracker API. See: https://matomo.org/faq/general/faq_19212/ | `36D0C594-E017-485B-B032-C436` | `36D0C594-E017-485B-B032-C436` |
3334
| `MATOMO_HOST` | url | | | URL where the Matomo is hosted | `https://example.com` | `https://example.com` |
3435
| `MATOMO_SITE_ID` | string | | | Website ID for the Matomo tracker API. See: https://matomo.org/faq/general/faq_19212/ | `36D0C594-E017-485B-B032-C436` | `36D0C594-E017-485B-B032-C436EC876E5B` |

apps/pdc-frontend/src/components/KCMSurvey/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,21 @@ export const KCMSurvey = ({ nonce }: KCMSurveyProps) => {
1818
const kcmSurveyURL = buildURL({
1919
env: process.env,
2020
key: 'KCM_SURVEY_URL',
21-
segments: ['surveyembedding', 'v4.48', 'kcm-survey.js'],
21+
// the current API behaver is when you don't provide a version it pulls the latest version
22+
segments: ['surveyembedding', process.env.KCM_SURVEY_VERSION ?? '', 'kcm-survey.js'].filter(Boolean),
2223
});
2324
const kcmSurveyStylesheetLink = buildURL({
2425
env: process.env,
2526
key: 'KCM_SURVEY_STYLESHEETS_LINK',
2627
segments: ['fileadmin', 'kcm-radio.css'],
2728
});
2829

29-
if (!process.env.KCM_SURVEY_URL || !process.env.KCM_SURVEY_ID || !process.env.KCM_SURVEY_API_KEY) {
30+
if (
31+
!process.env.KCM_SURVEY_URL ||
32+
!process.env.KCM_SURVEY_ID ||
33+
!process.env.KCM_SURVEY_API_KEY ||
34+
!process.env.KCM_SURVEY_VERSION
35+
) {
3036
return null;
3137
}
3238

apps/strapi.frameless.io/docs/developers/ENVIRONMENT_VARIABLES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
| `KCM_SURVEY_ID` | string | | | Survey ID for the KCM Survey widget, used to identify which survey to display. | `add-kcm-survey-id` | `` |
3030
| `KCM_SURVEY_STYLESHEETS_LINK` | url | | | URL for the custom stylesheet for the KCM Survey widget (e.g., https://www.utrecht.nl/fileadmin/kcm-radio.css). | `https://www.utrecht.nl` | `https://www.utrecht.nl` |
3131
| `KCM_SURVEY_URL` | url | | | Base URL for the KCM Survey service where the survey widget is hosted. | `https://viewer.kcmg.nl/` | `https://viewer.kcmg.nl/` |
32+
| `KCM_SURVEY_VERSION` | string | | | Version of the KCM Survey widget to use (e.g., 'latest' or specific version number). | `v4.49` | `` |
3233
| `MATOMO_CONTAINER_ID` | string | | | Container ID for the Matomo tracker API. See: https://matomo.org/faq/general/faq_19212/ | `36D0C594-E017-485B-B032-C436` | `36D0C594-E017-485B-B032-C436` |
3334
| `MATOMO_HOST` | url | | | URL where the Matomo is hosted | `https://example.com` | `https://example.com` |
3435
| `MATOMO_SITE_ID` | string | | | Website ID for the Matomo tracker API. See: https://matomo.org/faq/general/faq_19212/ | `36D0C594-E017-485B-B032-C436` | `36D0C594-E017-485B-B032-C436EC876E5B` |

docker-compose.pdc.dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ services:
6969
KCM_SURVEY_ID: ${KCM_SURVEY_ID}
7070
KCM_SURVEY_STYLESHEETS_LINK: ${KCM_SURVEY_STYLESHEETS_LINK}
7171
KCM_SURVEY_URL: ${KCM_SURVEY_URL}
72+
KCM_SURVEY_VERSION: ${KCM_SURVEY_VERSION}
7273
MATOMO_HOST: ${MATOMO_HOST}
7374
MATOMO_SITE_ID: ${MATOMO_SITE_ID}
7475
MATOMO_CONTAINER_ID: ${MATOMO_CONTAINER_ID}

docker-compose.pdc.prod.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ services:
6161
KCM_SURVEY_ID: ${KCM_SURVEY_ID}
6262
KCM_SURVEY_STYLESHEETS_LINK: ${KCM_SURVEY_STYLESHEETS_LINK}
6363
KCM_SURVEY_URL: ${KCM_SURVEY_URL}
64+
KCM_SURVEY_VERSION: ${KCM_SURVEY_VERSION}
6465
MATOMO_HOST: ${MATOMO_HOST}
6566
MATOMO_SITE_ID: ${MATOMO_SITE_ID}
6667
MATOMO_CONTAINER_ID: ${MATOMO_CONTAINER_ID}

0 commit comments

Comments
 (0)