diff --git a/example-apps/internal-knowledge-search/app-ui/.env b/example-apps/internal-knowledge-search/app-ui/.env index 069c2d7a..b8a8eea7 100644 --- a/example-apps/internal-knowledge-search/app-ui/.env +++ b/example-apps/internal-knowledge-search/app-ui/.env @@ -1,3 +1,3 @@ -SEARCH_APP_NAME=some-search-application -SEARCH_APP_API_KEY=xxxxxxxxxxxxxxxxxxx -SEARCH_APP_ENDPOINT=https://some-search-end-point.co \ No newline at end of file +REACT_APP_SEARCH_APP_NAME=some-search-application +REACT_APP_SEARCH_APP_API_KEY=xxxxxxxxxxxxxxxxxxx +REACT_APP_SEARCH_APP_ENDPOINT=https://some-search-end-point.co \ No newline at end of file diff --git a/example-apps/internal-knowledge-search/app-ui/README.md b/example-apps/internal-knowledge-search/app-ui/README.md index b8b5e5e1..176ea99e 100644 --- a/example-apps/internal-knowledge-search/app-ui/README.md +++ b/example-apps/internal-knowledge-search/app-ui/README.md @@ -106,5 +106,8 @@ To be able to use the index filtering and sorting in the UI you should update th ### Setting the environment variables -You need to set `SEARCH_APP_NAME`, `SEARCH_APP_API_KEY` and `SEARCH_APP_ENDPOINT` inside [.env](.env) to the corresponding values, which you'll get when [creating a search application](https://www.elastic.co/guide/en/enterprise-search/current/search-applications.html). +You need to set `REACT_APP_SEARCH_APP_NAME`, `REACT_APP_SEARCH_APP_API_KEY` and `REACT_APP_SEARCH_APP_ENDPOINT` inside [.env](.env) to the corresponding values, which you'll get when [creating a search application](https://www.elastic.co/guide/en/enterprise-search/current/search-applications.html). +### Security consideration + +As you provide the `REACT_APP_SEARCH_APP_API_KEY`, make sure this is a restricted API Key as this will be available in the browser. More information about Search application security and alternatives approaches can be found [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-application-security.html). diff --git a/example-apps/internal-knowledge-search/app-ui/src/store/slices/searchApplicationSettingsSlice.ts b/example-apps/internal-knowledge-search/app-ui/src/store/slices/searchApplicationSettingsSlice.ts index 329cd536..c7e54110 100644 --- a/example-apps/internal-knowledge-search/app-ui/src/store/slices/searchApplicationSettingsSlice.ts +++ b/example-apps/internal-knowledge-search/app-ui/src/store/slices/searchApplicationSettingsSlice.ts @@ -1,9 +1,9 @@ import {createSlice, PayloadAction} from '@reduxjs/toolkit'; import {SearchApplicationSettingsModel} from "../../models/SearchApplicationSettingsModel"; const initialState: SearchApplicationSettingsModel = { - appName: process.env.SEARCH_APP_NAME || "some-search-application", - apiKey: process.env.SEARCH_APP_API_KEY || "xxxxxxxxxxxxxxxxxxx", - searchEndpoint: process.env.SEARCH_APP_ENDPOINT || "https://some-search-end-point.co", + appName: process.env.REACT_APP_SEARCH_APP_NAME || "some-search-application", + apiKey: process.env.REACT_APP_SEARCH_APP_API_KEY || "xxxxxxxxxxxxxxxxxxx", + searchEndpoint: process.env.REACT_APP_SEARCH_APP_ENDPOINT || "https://some-search-end-point.co", }; const searchApplicationSettingsSlice = createSlice({