Send LML_API_KEY bearer header on all LML calls#535
Merged
Conversation
Injects Authorization: Bearer ${LML_API_KEY} at the lmlFetch chokepoint in apps/backend/services/lml/lml.client.ts so every call to LML carries the bearer when the env var is set. When unset or empty, no Authorization header is added — behavior is unchanged in dev environments without the var.
LML rolls out enforcement gradually (LML_REQUIRE_AUTH defaults false on the server), so this PR is safe to deploy ahead of the flag flip.
Closes #534
994fc41 to
8529260
Compare
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Authorization: Bearer ${LML_API_KEY}at thelmlFetchchokepoint inapps/backend/services/lml/lml.client.ts. Single change covers all 7 LML calls (lookup, releases, artist, entity, track-releases, validate-track, streaming-check, library search).LML_API_KEYis unset or empty, noAuthorizationheader is sent. Behavior unchanged in dev environments.This is PR #2 in the LML auth rollout. PR #1: WXYC/library-metadata-lookup#165 (merged). LML's
LML_REQUIRE_AUTHdefaults tofalse, so this PR is safe to deploy ahead of the flag flip.Closes #534
Test plan
npm run test:unit— 1097 passed (22 inlml.client.test.tsincluding the 5 new ones)npm run typecheck— cleannpm run linton changed files — no new issuesLML_API_KEYin EC2 env to match LML/api/v1/streaming-checkfrom Backend still works (should be no-op since LML's flag is off)