elastic / app-search-reference-ui-react

A generic UI for use with any App Search Engine
https://www.elastic.co/products/app-search
Apache License 2.0
65 stars 24 forks source link

[Feature Request] Support SearchKey as an Environment Variable #82

Open christophercutajar opened 3 years ago

christophercutajar commented 3 years ago

Having the searchKey in the clear in engine.json is not the best approaches from a security point of view.

It would be great if the searchKey can be read at runtime from an environment variable.

As an example the AppSearchAPIConnector connector would be something like the following:

const connector = new AppSearchAPIConnector({
  searchKey: process.env.REACT_APP_APPSEARCH_SEARCHKEY,
  engineName,
  hostIdentifier,
  endpointBase
});

Would like to get your opinion on this before performing any work. Ready to submit a PR for this feature 😄

JasonStoltz commented 3 years ago

That's a good idea. We'd need to update the README to change the start command to include the environment variable. We'll also need to make the corresponding change in App Search, which could target 7.15.

christophercutajar commented 3 years ago

Raised https://github.com/elastic/app-search-reference-ui-react/pull/83 for ReferenceUI. I'm not sure what changes are required in AppSearch to the download ZIP package feature.