Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set connect timeout configuration for Algolia php client #379

Closed
0x4r45h opened this issue Jul 6, 2019 · 3 comments
Closed

Set connect timeout configuration for Algolia php client #379

0x4r45h opened this issue Jul 6, 2019 · 3 comments

Comments

@0x4r45h
Copy link

0x4r45h commented Jul 6, 2019

  • Scout Version: 7.1.1
  • Laravel Version: 5.7.7
  • PHP Version: 7..2

Description:

i want to customize the timeout values in algolia php client , as described here
is it possible / how to set these kind of configuration through scout ?

Workaround

i have managed to set my desired configurations by calling extend function on EngineManger class in AppServiceProvider:

        $this->app->resolving(EngineManager::class,function ($engine,$app){
                        $engine->extend('algolia',function (){
                        UserAgent::addCustomUserAgent('Laravel Scout', '7.0.0');
                        $config = SearchConfig::create(config('scout.algolia.id'), config('scout.algolia.secret'));
                        $config->setConnectTimeout(config('scout.algolia.connectTimeout'));
                        $config->setReadTimeout(config('scout.algolia.readTimeout'));
                        $config->setWriteTimeout(config('scout.algolia.writeTimeout'));
                        return new AlgoliaEngine(
                            Algolia::createWithConfig($config),
                            config('scout.soft_delete')
                        );
                    });
        });

but its kinda hackish,is there any other better way ?

@driesvints
Copy link
Member

Think this would be a feature request. If you can send in a PR which implements the SearchConfig in a clean way that would be nice. My first thoughts are of indeed adding the settings to the Algolia config.

@0x4r45h
Copy link
Author

0x4r45h commented Sep 10, 2019

@tillkruss just a few days after i opened this, algolia banned all iranians IPs due to sanctions ,both in frontend and client side APIs , so there is no point for me to contribute , feel free to send PR

@driesvints
Copy link
Member

Since only one person has requested this and doesn't needs it anymore I'm gonna close this. Welcoming prs however.

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

No branches or pull requests

2 participants