From 8a9d0ae3c0e6ad3b2d50536dd6a148336314f598 Mon Sep 17 00:00:00 2001 From: christophercutajar <60098546+christophercutajar@users.noreply.github.com> Date: Wed, 21 Jul 2021 17:11:03 +0200 Subject: [PATCH] Reading searchkey from environment variable --- README.md | 3 +++ src/App.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e7e6612..4d4af38 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,9 @@ Run the following commands to start this application: # below with the actual path of your project. cd ~/Downloads/app-search-reference-ui +#Run this command to save the searchKey as an envrionment variable. This is required to Reference UI to connect to App Search. Replace the search key with the actual key from the App Search credentials section. +export REACT_APP_APPSEARCH_SEARCHKEY=search-XXXXXXXXXXXXXXXXXXXXXXX + # Run this to set everything up npm install diff --git a/src/App.js b/src/App.js index f480e55..bc910e3 100644 --- a/src/App.js +++ b/src/App.js @@ -26,9 +26,9 @@ import { getFacetFields } from "./config/config-helper"; -const { hostIdentifier, searchKey, endpointBase, engineName } = getConfig(); +const { hostIdentifier, endpointBase, engineName } = getConfig(); const connector = new AppSearchAPIConnector({ - searchKey, + searchKey: process.env.REACT_APP_APPSEARCH_SEARCHKEY, engineName, hostIdentifier, endpointBase