Skip to content
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

Fixed GraphQL Playground with custom configuration in production. #1495

Merged
merged 7 commits into from
Aug 14, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All of the packages in the `apollo-server` repo are released with the same versi
- express, koa: remove next after playground [#1436](https://github.com/apollographql/apollo-server/pull/1436)
- Hapi: Pass the response toolkit to the context function. [#1407](https://github.com/apollographql/apollo-server/pull/1407)
- update apollo-engine-reporting-protobuf to non-beta [#1429](https://github.com/apollographql/apollo-server/pull/1429)
- Fix to allow enabling GraphQL Playground in production with custom config [#1495](https://github.com/apollographql/apollo-server/pull/1495)

### rc.10

Expand Down
3 changes: 2 additions & 1 deletion packages/apollo-server-core/src/playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export function createPlaygroundOptions(
playground: PlaygroundConfig = {},
): PlaygroundRenderPageOptions | undefined {
const isDev = process.env.NODE_ENV !== 'production';
const enabled: boolean = typeof playground === 'boolean' ? playground : isDev;
const enabled: boolean =
typeof playground !== 'undefined' ? !!playground : isDev;

if (!enabled) {
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('apollo-server-express', () => {

it('accepts partial GraphQL Playground Options', async () => {
const nodeEnv = process.env.NODE_ENV;
delete process.env.NODE_ENV;
process.env.NODE_ENV = 'production';

const defaultQuery = 'query { foo { bar } }';
const endpoint = '/fumanchupacabra';
Expand Down