Skip to content

Conversation

@dave-ok
Copy link
Member

@dave-ok dave-ok commented Aug 7, 2020

PR Checklist

  • Run npm run lint to find errors in code syntax/format
  • Run npm run lint:fix to fix all auto-fixable errors in source code and auto-format with prettier
  • Ensure you fix any linting errors displayed after running any of the above commands

What does this PR do

Fixes #538

A middleware to retrieve remote settings on each request, parse and validate settings, and attach settings to request object, for availability down the middleware chain in the request/response cycle

Description of Task to be completed

  • Create settings parser
  • Add validation option to parser
  • Write tests for parser
  • Create middleware to
    • validate API key,
    • decode projectID from API key signed with a shared secret,
    • retrieve settings for given projectID,
    • parse and validate returned settings
    • attach projectID and settings on request object
  • Write tests for middleware

How should this be manually tested

Run npm run test src/utils/__test__/settingsParser.test.js to test settings parser/validator
Run npm run test src/middleware/__test__/settings.test.js to test middleware

Any background context you want to provide

The settings middleware currently pulls mocked settings from a function in src/utils/mocks/settings which will be replaced by the actual settings provider when implemented

@dave-ok dave-ok added the enhancement New feature or request label Aug 7, 2020
@dave-ok
Copy link
Member Author

dave-ok commented Aug 7, 2020

Closed to reopen from fork

@dave-ok dave-ok closed this Aug 7, 2020
@simply-alliv simply-alliv mentioned this pull request Aug 10, 2020
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] - Add settings middleware

2 participants