Skip to content

Commit

Permalink
Small changes to documentation and initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
theodorDiaconu committed May 8, 2019
1 parent 6218f91 commit 11a17f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ initialize({
// You must not override schema

// You can add `schemaDirectives` and `context` without worrying about context update
schemaDirectives: [MyCustomDirective],
schemaDirectives: {
MyCustomDirective,
},
context: async () => ({
services
})
Expand Down
13 changes: 7 additions & 6 deletions server/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ export default function initialize(apolloConfig = {}, meteorApolloConfig = {}) {
const { typeDefs, resolvers } = getSchema();

const initialApolloConfig = Object.assign({}, apolloConfig);

const schemaDirectives = {
...defaultSchemaDirectives,
...(initialApolloConfig.schemaDirectives ? initialApolloConfig.schemaDirectives : {}),
};

apolloConfig = {
introspection: Meteor.isDevelopment,
debug: Meteor.isDevelopment,
Expand All @@ -46,12 +52,7 @@ export default function initialize(apolloConfig = {}, meteorApolloConfig = {}) {
...initialApolloConfig,
typeDefs,
resolvers,
schemaDirectives: {
...defaultSchemaDirectives,
...(initialApolloConfig.schemaDirectives
? initialApolloConfig.schemaDirectives
: []),
},
schemaDirectives,
context: getContextCreator(meteorApolloConfig, initialApolloConfig.context),
subscriptions: getSubscriptionConfig(meteorApolloConfig),
};
Expand Down

0 comments on commit 11a17f9

Please sign in to comment.