Skip to content

Commit

Permalink
fix: allow passing of any option to Contentful SDK again
Browse files Browse the repository at this point in the history
  • Loading branch information
axe312ger committed Mar 15, 2021
1 parent 3568845 commit 227754c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/gatsby-source-contentful/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ The environment to pull the content from, for more info on environments check ou

Downloads and caches `ContentfulAsset`'s to the local filesystem. Allows you to query a `ContentfulAsset`'s `localFile` field, which is not linked to Contentful's CDN. Useful for reducing data usage.

You can pass in any other options available in the [contentful.js SDK](https://github.com/contentful/contentful.js#configuration).

**`localeFilter`** [function][optional] [default: `() => true`]

Possibility to limit how many locales/nodes are created in GraphQL. This can limit the memory usage by reducing the amount of nodes created. Useful if you have a large space in Contentful and only want to get the data from one selected locale.
Expand Down Expand Up @@ -181,6 +179,12 @@ Number of entries to retrieve from Contentful at a time. Due to some technical l

Number of workers to use when downloading Contentful assets. Due to technical limitations, opening too many concurrent requests can cause stalled downloads. If you encounter this issue you can set this param to a lower number than 50, e.g 25.

**`contentfulClientConfig`** [object][optional] [default: `{}`]

Additional config which will get passed to [Contentfuls JS SDK](https://github.com/contentful/contentful.js#configuration).

Use this with caution, you might override values this plugin sets for you to connect to Contentful.

## Notes on Contentful Content Models

There are currently some things to keep in mind when building your content models at Contentful.
Expand Down
2 changes: 2 additions & 0 deletions packages/gatsby-source-contentful/src/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ module.exports = async function contentfulFetch({
.join(` `)
)
},
// Allow passing of custom configuration to the Contentful SDK like headers
...(pluginConfig.get(`contentfulClientConfig`) || {}),
}

const client = contentful.createClient(contentfulClientOptions)
Expand Down

0 comments on commit 227754c

Please sign in to comment.