Implement user-facing error message for missing Elasticsearch API keys for local copies of the site

What does this MR do and why?

WHAT

This MR does two things,

  1. Displays UI error message in production site if CI/CD variables for ELASTIC_CLOUD_ID, ELASTIC_KEY and ELASTIC_INDEX are missing.
  2. make view command will now check ELASTIC_CLOUD_ID, ELASTIC_KEY and ELASTIC_INDEX BEFORE updating icons, building frontend, and serving Hugo server and print out an INFO message.

WHY

  • A UI error message is useful for users in production. Especially if we had accidentally removed a required Elasticsearch config variable.
  • The local make view printing an INFO message with specifics on missing config/s is useful if the developer is trying to do local search; so that a developer running the site locally gets an early warning/info before site is fully compiled.

Screenshots or screen recordings

Production error handling for missing Elasticsearch config:

Before After
image image
image image

Local "error" handling for missing Elasticsearch config:

image

How to set up and validate locally

  1. Checkout this branch.
  2. Run unset ELASTIC_KEY to remove it from terminal. You can also unset ELASTIC_INDEX and ELASTIC_CLOUD_ID as well to check those.
  3. Run make view on the same terminal.
  4. Search in the landing page and it should show the same as the first "After" screenshot in the table.
  5. Search in the /search/ page and it should show the same as the second screenshot.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Closes #151 (closed)

Edited by Hiru Fernando

Merge request reports

Loading