meilisearch/landing

Add default values to Instant Meilisearch's client

Closed this issue · 3 comments

Description
The Interactive Search component on the homepage allows us to display and search inside movies:

Capture d’écran 2022-09-13 à 09 13 57

To do so, we use Instant Meilisearch. The client needs to be initialized with a host and an apiKey (NEXT_PUBLIC_DEMO_MOVIES_HOST and NEXT_PUBLIC_DEMO_MOVIES_API_KEY).

By running the website locally, these environment variables are loaded thanks to a .env file, but if they are not provided, the website crashes on yarn dev:

Capture d’écran 2022-09-13 à 09 17 33

We should provide a default value to these environment variables. I suggest http://0.0.0.0:7700 as a host, and searchKey for the apiKey.

The changes should be made inside the src/components/InteractiveSearch.js component, inside the .env.example, and also inside the src/stories/Searchbox.stories.js file as well.

@mdubus I have created a PR for this. Can you please authorize it?

Hey @arifszn, @mdubus is away at the moment :) Thanks for your contribution! I will review it

Fixed by #486