◐ Shell
clean mode source ↗

feat(@angular/cli): allow Algolia search key override via env var by gn00295120 · Pull Request #33081 · angular/angular-cli

@gn00295120

The MCP `search_documentation` tool currently uses a single bundled
Algolia API key for the public Angular documentation index. This works
out of the box but gives operators no way to:

* substitute a different key for self-hosted documentation indices,
* point an internal CI environment at a separate Algolia application
  to avoid sharing the public rate-limit budget,
* test key rotation without rebuilding the CLI.

This change adds a `NG_DOCS_SEARCH_API_KEY` environment variable that,
when set to a non-empty string, is used verbatim in place of the
bundled key. When the variable is absent or empty, behaviour is
unchanged — the bundled key continues to be used.

The override path is factored into a small `resolveAlgoliaApiKey()`
helper so the env-var precedence rules are unit-testable without
spinning up the full MCP tool runner. Three Jasmine specs cover:
override set, override unset, and override set to empty string.

The previous comment block on `ALGOLIA_API_E` is replaced with a
short note describing the override mechanism and the operator
scenarios it enables.