Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save patrickisgreat/a07b504a3e867a9edff6f122e3810947 to your computer and use it in GitHub Desktop.
Save patrickisgreat/a07b504a3e867a9edff6f122e3810947 to your computer and use it in GitHub Desktop.
function addConditionalPlugins(plugins) {
const config = AppConfig.get();
if (config.responseCacheEnabled) {
plugins.push(
responseCachePlugin({
sessionId: async (requestContext) =>
requestContext.request.http?.headers.get("sc-user") ?? null,
})
);
}
if (config.nodeEnv === "production") {
plugins.push(ApolloServerPluginLandingPageDisabled());
} else {
plugins.push(ApolloServerPluginLandingPageLocalDefault({ embed: true }));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment