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

Use a proxy ? #59

Closed
adpeyre opened this issue May 23, 2024 · 4 comments
Closed

Use a proxy ? #59

adpeyre opened this issue May 23, 2024 · 4 comments
Assignees

Comments

@adpeyre
Copy link
Contributor

adpeyre commented May 23, 2024

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

@adpeyre
Copy link
Contributor Author

adpeyre commented May 23, 2024

If you are agree with #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);
    }
}

@adpeyre
Copy link
Contributor Author

adpeyre commented May 24, 2024

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']

@jeromegamez
Copy link
Member

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.

@jeromegamez
Copy link
Member

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.

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

No branches or pull requests

2 participants