diff --git a/connect.yaml b/connect.yaml index 45b2a3b..84d25d3 100644 --- a/connect.yaml +++ b/connect.yaml @@ -18,6 +18,8 @@ deployAs: description: Commercetools client scope - key: CTP_REGION description: Region of Commercetools project + - key: SEARCH_PLATFORM_CONFIG + description: Escaped JSON object including credentails to search platform and other settings - name: incremental-updater applicationType: event endpoint: / diff --git a/full-ingestion/src/extensions/algolia-example/configurations/config.js b/full-ingestion/src/extensions/algolia-example/configurations/config.js index 9712e9b..5c3717a 100644 --- a/full-ingestion/src/extensions/algolia-example/configurations/config.js +++ b/full-ingestion/src/extensions/algolia-example/configurations/config.js @@ -1,5 +1,15 @@ +function loadConfig() { + try { + return JSON.parse(process.env.SEARCH_PLATFORM_CONFIG); + } catch (e) { + throw new Error( + 'Search platform configuration is not provided in the JSON format' + ); + } +} + export const config = { - applicationId: process.env.AGOLIA_APPLICATION_ID, - searchApiKey: process.env.AGOLIA_SEARCH_API_KEY, - index: process.env.AGOLIA_INDEX, + applicationId: loadConfig().applicationId, + searchApiKey: loadConfig().searchApiKey, + index: loadConfig().index, };