Skip to content

Commit

Permalink
new version
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrurodr committed Mar 4, 2022
1 parent f5d7a27 commit ea7a979
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ function wrapWebhook(webhook, payload) {
return function () {
return __awaiter(this, void 0, void 0, function* () {
try {
yield axios_1.default.post(webhook, payload, { maxRedirects: 20 });
const fullProxy = process.env['http_proxy'] || process.env['HTTP_PROXY'] || process.env['https_proxy'] || process.env['HTTPS_PROXY'];
const host = fullProxy ? fullProxy.split(':')[0] : '';
const port = fullProxy ? parseInt(fullProxy.split(':')[1]) : '';
const proxy = host && port ? { proxy: { host, port } } : {};
yield axios_1.default.post(webhook, payload, proxy);
}
catch (e) {
if (e.response) {
Expand Down

0 comments on commit ea7a979

Please sign in to comment.