Closed adpeyre closed 2 months ago
If you are agree with https://github.com/kreait/firebase-bundle/pull/60 , I could use my own ProjectFactory class to define the proxy.
class ProjectFactory extends \Kreait\Firebase\Symfony\Bundle\DependencyInjection\Factory\ProjectFactory
{
public function createFactory(array $config = []): Factory
{
$factory = parent::createFactory($config);
$httpClientOptions = HttpClientOptions::default();
$httpClientOptions = $httpClientOptions->withGuzzleConfigOptions([
'proxy' => 'http://proxy',
]);
return $factory->withHttpClientOptions($httpClientOptions);
}
}
I decided not to use the bundle. There are some issues and I can't override configurations. So I used the php sdk only.
I share my config for a messaging usage with an unique client :
####
# Kreait Firebase
####
kreait_firebase.http_config_options:
class: Kreait\Firebase\Http\HttpClientOptions
factory: ['Kreait\Firebase\Http\HttpClientOptions', 'default']
calls:
- withProxy: !returns_clone ['%env(HDS_HTTP_PROXY)%']
Kreait\Firebase\Factory:
calls:
- withHttpClientOptions: !returns_clone ['@kreait_firebase.http_config_options']
- withServiceAccount: !returns_clone ['%env(resolve:FIREBASE_CREDENTIALS_PATH)%']
- withHttpLogger: !returns_clone ['@monolog.logger.firebase']
Kreait\Firebase\Contract\Messaging:
factory: ['@Kreait\Firebase\Factory', 'createMessaging']
Good call, that's how I would recommend it anyway - perhaps I should update the README at some point...
Anyway, thanks for sharing, it will certainly be useful to others. I'll keep this and/or the other issue open for the time being, perhaps I can find some time somewhen.
Since you've given an example how to use the SDK without this bundle (again: 👏), and I've merged #60, I'll close this issue now, but feel free to add further comments if you'd like.
Describe the feature you would like to see
Hello,
Could you add the possibility yo use a proxy ? Maybe add a http client config in the bundle configuration ?
Do you already have a solution ?
Ty