-
Notifications
You must be signed in to change notification settings - Fork 1
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
PER-9717 [back-end] Endpoint to retrieve environment configuration #127
Conversation
efdfe92
to
bca3cbb
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.
You're generally on the right path here as far as how we write endpoints and what this one should do. I've added a couple comments in places where I think a better course exists.
You asked also whether there are any additional fields this endpoint should return; I've now added an OpenAPI specification describing the desired endpoint in detail (though that specification need not be taken as dogma; if you see a better way by all means present your case for it). If you prefer not to read the YAML directly, you can create a much nicer HTML version of the specification by running redocly build-docs packages/api/docs/present/api.yaml
(we have just recently adopted this API specification format and aren't yet hosting a docs site).
Some other documentation that might give you useful further context:
The longer term plan for feature flags
Our best practices for API design
I updated the PR with the suggested changes, please have a look. I also saw in the best practices API design page that for lists of object we want to have pagination. Does this apply to the feature_flags as well? Also should I create the other CRUD methods to this entity? Thanks |
I think feature flags are most naturally an exception to this rule. From the user-facing client's perspective, it would be a hassle to have to make several calls through multiple pages of feature flags in order to determine which features should be active. From the admin panel's perspective, pagination might be more reasonable, but I think realistically we should never have so many feature flags at once that they would be unmanageable without pagination (unless we neglect to delete old ones, but then the lack of pagination may become a useful inducement to not neglect that).
I think that would be a great thing for you to do once this endpoint is done; the create and update methods are higher priority than delete. The tickets for those endpoints are here: |
3523a60
to
f2e0d9f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #127 +/- ##
==========================================
- Coverage 88.12% 86.67% -1.46%
==========================================
Files 75 78 +3
Lines 1347 1403 +56
Branches 207 213 +6
==========================================
+ Hits 1187 1216 +29
- Misses 146 171 +25
- Partials 14 16 +2 ☔ View full report in Codecov by Sentry. |
f1d9ffe
to
7668dd8
Compare
455714b
to
e652b29
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.
Just one more comment, then I think this will be ready to merge!
ed5dacd
to
df44d7f
Compare
next: NextFunction | ||
): Promise<void> => { | ||
const authenticationToken = getAuthTokenFromRequest(req); | ||
const email = await getOptionalValueFromAuthToken( |
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 found one more thing while testing locally - this function will throw an exception (because of the way the Fusionauth client works) if it receives an authenticationToken
that's an empty string. Since we don't want that case to fail, we should check for an empty authenticationToken
and then only call this if it's not empty.
New endpoint feature-flags that will return a list of globally enabled flag names if the user is not authenticated or a regular user and all feature flags if the user is an administrator Functional testing was added for both scenarios
PER-9717 [back-end] Endpoint to retrieve environment configuration