Skip to content

feat(config): Allow options to be passed to algoliasearch#158

Merged
Haroenv merged 3 commits intoalgolia:masterfrom
bartdeslagmulder:master
Dec 14, 2021
Merged

feat(config): Allow options to be passed to algoliasearch#158
Haroenv merged 3 commits intoalgolia:masterfrom
bartdeslagmulder:master

Conversation

@bartdeslagmulder
Copy link
Copy Markdown
Contributor

We're using a corporate proxy and cannot make gatsby-plugin-algolia work without passing a custom requester.

I found this PR (algolia/algoliasearch-client-javascript#1180) where createNodeHttpRequester was extended to pass a custom HTTP agent.
With this change you can pass an optional custom requester to gatsby-plugin-algolia which resolved our issue.

Feedback is welcome. Let me know if I still need to change/add something.
Thanks in advance!

Bart (from 🇧🇪)

…a corporate proxy

We're using a corporate proxy and cannot make `gatsby-plugin-algolia` work without passing a custom requester.

I found this PR (algolia/algoliasearch-client-javascript#1180) where `createNodeHttpRequester` was extended to pass a custom HTTP agent.
With this change you can pass a custom requester to `gatsby-plugin-algolia` which resolved our issue.
@Haroenv
Copy link
Copy Markdown
Contributor

Haroenv commented Dec 13, 2021

I think the use case makes sense, but I see two alternatives to this PR:

  1. accept an already initialised algoliasearch as a parameter
  2. accepts the clientOptions as a parameter

I prefer both of those options, as they are less likely to need an option per client option, but not sure which of those two is better.

Not sure if you have an opinion, but if you could choose one of those two you think fits the best, and also update the readme, I'd accept immediately :)

Groetjes!

@bartdeslagmulder
Copy link
Copy Markdown
Contributor Author

Tnx for the quick reply @Haroenv!

Option 2 would be better as you already require algoliasearch in your package.
I'll set the defaults for the clientOptions with the current timeouts obj.

Will try to update today/tomorrow.

@Haroenv
Copy link
Copy Markdown
Contributor

Haroenv commented Dec 13, 2021

That sounds good, thanks!

@Haroenv Haroenv changed the title feat(config): Add requester param to pass custom HTTP agent to algoliasearch feat(config): Allow options to be passed to algoliasearch Dec 14, 2021
@Haroenv Haroenv merged commit 687ca20 into algolia:master Dec 14, 2021
@Haroenv
Copy link
Copy Markdown
Contributor

Haroenv commented Dec 14, 2021

released in 0.25.0, thanks again!

@bartdeslagmulder
Copy link
Copy Markdown
Contributor Author

I started updating the README - but focus shifted on something else and I didn't commit yet. But I saw you did. 👍
Thank you @Haroenv! Have a nice day.

@Haroenv
Copy link
Copy Markdown
Contributor

Haroenv commented Dec 14, 2021

no problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants