-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 #5025: Add env. vars. for graphql playground and introspection #5055
Refactor #5025: Add env. vars. for graphql playground and introspection #5055
Conversation
5ae0a09
to
4c605be
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.
Thanks for working on this! There are a couple things to fix, but after that should be good to merge.
4c605be
to
666b347
Compare
… and introspection Signed-off-by: Bruno Lehnen <[email protected]>
666b347
to
c0e1968
Compare
@aldeed, thanks a million for reviewing my PR and for letting me contribute. |
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.
Tested. Works!
This is ready to merge, but I need to figure out how we can update the integration tests to continue passing. Envalid does not like the value of NODE_ENV when tests are running it seems. |
That's Great @aldeed! Also, if you want, I can help you out with those failing tests too, just let me know 👍 |
Fixes integration test errors Signed-off-by: Eric Dobbertin <[email protected]>
Resolves #5025
Impact: minor
Type: refactor
Issue
In development, Apollo Server enables GraphQL Playground on the same URL as the GraphQL server itself (e.g. http://localhost:4000/graphql) and automatically serves the GUI to web browsers. When NODE_ENV is set to production, GraphQL Playground (as well as introspection) is disabled as a production best-practice.
Solution
Set environment variables with "envalid" in order to determine whether GraphQL Playground should be enabled or not in any environment.
Breaking changes
These changes are all pretty harmless, the only exception to that which has the capacity of causing an error is adding invalid boolean values to the newly added environment vars. (GRAPHQL_INTROSPECTION_ENABLED and GRAPHQL_PLAYGROUND_ENABLED).
FYI - Following are the accepted values for boolean environment variables in the "envalid" lib. : "0", "1", "true", "false", "t", "f"
Testing