Skip to content

Commit

Permalink
feat(core): configurable playground options
Browse files Browse the repository at this point in the history
  • Loading branch information
ondratra committed Jul 22, 2021
1 parent 7de37a7 commit 19657d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@joystream/warthog",
"version": "2.37.1-sumer",
"version": "2.37.2-sumer",
"description": "Opinionated set of tools for setting up GraphQL backed by TypeORM",
"main": "dist/index.js",
"types": "dist/types/index.d.ts",
Expand Down
12 changes: 8 additions & 4 deletions src/core/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ export interface ServerOptions<T> {
warthogImportPath?: string;
introspection?: boolean; // DEPRECATED
bodyParserConfig?: OptionsJson;
queryTemplates?: IQueryTemplate[];
playgroundConfig?: {
queryTemplates?: IQueryTemplate[];
version?: string;
cdnUrl?: string;
};
onBeforeGraphQLMiddleware?: (app: express.Application) => void;
onAfterGraphQLMiddleware?: (app: express.Application) => void;
}
Expand Down Expand Up @@ -238,11 +242,11 @@ export class Server<C extends BaseContext> {
? {
playground: {
// this makes playground files to be served locally
version: '',
cdnUrl: '',
version: this.appOptions.playgroundConfig?.version || '',
cdnUrl: this.appOptions.playgroundConfig?.cdnUrl || '',

// pass custom query templates to playground
queryTemplates: this.appOptions.queryTemplates || []
queryTemplates: this.appOptions.playgroundConfig?.queryTemplates || []
}
}
: {};
Expand Down

0 comments on commit 19657d7

Please sign in to comment.