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

Unable to set Guzzle config options / headers / proxy on Slack Notification #15837

Closed
arctic-ice-cool opened this issue Oct 9, 2016 · 10 comments

Comments

@arctic-ice-cool
Copy link

  • Laravel Version: 5.3.16
  • PHP Version: 5.6.24
  • Database Driver & Version: MySQL 5.5.46

Description:

I can't seem to be able to set the Guzzle config array to include the:

['proxy' => [
        'http'  => $proxy_http,
        'https' => $proxy_https,
        'no' => $proxy_exclude
        ]

array when using the Slack notification driver. Is it possible to have a global configuration file for Guzzle as Laravel is dependent on it? It seems a shame to have to recreate a Slack notification channel just to include some Guzzle configuration parameters?

Steps To Reproduce:

Have a laravel app that uses the above configuration array variables when creating a new Guzzle Client for systems behind a corporate firewall with only a proxy to external access. or requires proxy access to the relevant notification channel.

@srmklive
Copy link
Contributor

I would rather do it like this:

$client = new \GuzzleHttp\Client;
$client->post('/', [
    'proxy' => [
        'http'  => $proxy_http,
        'https' => $proxy_https,
        'no' => $proxy_exclude
    ]
]);

@arctic-ice-cool
Copy link
Author

Yes that is how you do it and how you would do it if you made a custom slack notification channel, but seeing how all this is shipped with laravel, it just doesn't feel right to have to create another (duplicate) channel just to be able to configure the Guzzle connection.

@srmklive
Copy link
Contributor

@arctic-ice-cool Can you list the exact error stack you are getting?

@arctic-ice-cool
Copy link
Author

What error?
I am unable to provide the Guzzle client within the Slack notification channel the configuration variables for HTTP Proxy, HTTPS Proxy and Proxy Exclude settings

@srmklive
Copy link
Contributor

srmklive commented Oct 12, 2016

@arctic-ice-cool Which library are you using for connecting to slack? Also can you provide code you are writing?

@arctic-ice-cool
Copy link
Author

Sorry, I don't think you understand the issue (or it isn't an issue and the functionality does exist already)

Guzzle allows (as you can see in both our examples) to configure the proxy settings to which is applies to its CURL connections.

The slack notification channel built into Laravel uses Guzzle, but doesn't allow the injection of these settings to ensure Guzzle connects via a proxy.

See the Guzzle Documentation

Does that make more sense?

Thanks

@srmklive
Copy link
Contributor

@arctic-ice-cool I completely understand the Guzzle documentation :D. My question was whether you were using another package for connecting to slack

@arctic-ice-cool
Copy link
Author

OK great, thanks. No nothing, just Laravel, doing the standard Slack notification - it all works great. I just need to be able to specify proxy settings for Guzzle, and don't think it should be necessary (I know its not complicated) to duplicate the standard slack notification channel, just for the ability to pass Guzzle parameters.

Thanks

@themsaid
Copy link
Member

Please feel free to open a PR to suggest this change, this repo issues is for bug reporting only.

I think you need to change buildJsonPayload() in /src/Illuminate/Notifications/Channels/SlackWebhookChannel.php.

@arctic-ice-cool
Copy link
Author

I don't know how to do that, I don't use Git :( It's on my list to grasp when I get the chance though.

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

3 participants