Skip to content

Commit

Permalink
Update connect.yaml and edit config inside algolia-sample extension
Browse files Browse the repository at this point in the history
  • Loading branch information
leungkinghin-ct committed Aug 10, 2023
1 parent b6da7dc commit 5031a5e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions connect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: /
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
};

0 comments on commit 5031a5e

Please sign in to comment.