-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor/netlify toml #357
Conversation
93ba5d0
to
d731692
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems good generally but some comments and a general remark on the code structure
newroutes/netlifyToml.js
Outdated
const router = express.Router() | ||
|
||
router.get( | ||
"/netlify-toml", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should really maintain a mapping of keys to raw values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you clarify which raw values you're referring to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the /netlify-toml
. idt it's a big issue cos the path should be used minimally? (lmk if i'm wrong)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this is only used for this single endpoint - do you think router namespaces will help with this issue?
const netlifyTomlReadableContent = toml.parse(Base64.decode(content)) | ||
|
||
// Headers is an array of objects, specifying a set of access rules for each specified path | ||
// Under our current assumption, we apply the first set of access rules to all paths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think i might be lacking context - could i clarify what's the current assumption here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our assumption is that the file only contains a single set of access rules, so we take the first set!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we write that down in the comment too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, done in 6517e43
a6cdec7
to
5517d45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm; can be merged once the assumption is documented inside the comment!
newroutes/netlifyToml.js
Outdated
const router = express.Router() | ||
|
||
router.get( | ||
"/netlify-toml", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the /netlify-toml
. idt it's a big issue cos the path should be used minimally? (lmk if i'm wrong)
const netlifyTomlReadableContent = toml.parse(Base64.decode(content)) | ||
|
||
// Headers is an array of objects, specifying a set of access rules for each specified path | ||
// Under our current assumption, we apply the first set of access rules to all paths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we write that down in the comment too?
6517e43
to
a344e30
Compare
* Feat: add NetlifyTomlService * Feat: add netlifyToml router * Test: add new fixture for netlifyToml * Test: add tests for netlifyToml service and router * Fix: remove sitename from netlify-toml endpoint * Nit: add line space * Chore: include spec in name of test file and minor comment changes * Rebase: use auth verify middleware in router * Nit: add more details to comment * Fix: move routers to appropriate subrouters and swap to res.locals * Fix: axios mock in test for netlifytoml service
Overview
This PR introduces the refactor for the netlify toml retrieval flow. It introduces a newly created NetlifyTomlRouter and NetlifyTomlService.
Breaking Changes
Features:
Sites router
Notes:
The NetlifyToml router no longer uses the site name of the repo (compared to the v1 endpoint), as we retrieve this from the isomer-build repo rather than the individual site, and we don't actually use the siteName anywhere.