From fb8e2469e7c9e013fee1100bd2dce0f85b268f80 Mon Sep 17 00:00:00 2001 From: wyvern8 Date: Fri, 29 Jun 2018 07:03:22 +1000 Subject: [PATCH] fix(kms): add proxy support to utils --- src/KmsUtils.js | 8 ++++++++ src/serverless/gtmGithubHook/gtmGithubHook.js | 1 + .../gtmGithubMetricCapture/gtmGithubMetricCapture.js | 1 + src/serverless/gtmGithubResults/gtmGithubResults.js | 1 + 4 files changed, 11 insertions(+) diff --git a/src/KmsUtils.js b/src/KmsUtils.js index c0a186c9..3d2156e0 100644 --- a/src/KmsUtils.js +++ b/src/KmsUtils.js @@ -1,4 +1,12 @@ import * as AWS from 'aws-sdk'; +const proxy = require('proxy-agent'); +if (process.env.AWS_PROXY) { + AWS.config.update({ + httpOptions: { + agent: proxy(process.env.AWS_PROXY) + } + }); +} class KmsUtils { constructor() { diff --git a/src/serverless/gtmGithubHook/gtmGithubHook.js b/src/serverless/gtmGithubHook/gtmGithubHook.js index 631505fd..d8fe9a3f 100644 --- a/src/serverless/gtmGithubHook/gtmGithubHook.js +++ b/src/serverless/gtmGithubHook/gtmGithubHook.js @@ -1,5 +1,6 @@ 'use strict'; +console.log('cold start'); require('source-map-support').install(); let rp = require('request-promise-native'); let json = require('format-json'); diff --git a/src/serverless/gtmGithubMetricCapture/gtmGithubMetricCapture.js b/src/serverless/gtmGithubMetricCapture/gtmGithubMetricCapture.js index 98eb0e5e..da2fb38e 100644 --- a/src/serverless/gtmGithubMetricCapture/gtmGithubMetricCapture.js +++ b/src/serverless/gtmGithubMetricCapture/gtmGithubMetricCapture.js @@ -1,5 +1,6 @@ 'use strict'; +console.log('cold start'); const AWS = require('aws-sdk'); const HTTPS = require('https'); const PROXY_AGENT = require('https-proxy-agent'); diff --git a/src/serverless/gtmGithubResults/gtmGithubResults.js b/src/serverless/gtmGithubResults/gtmGithubResults.js index babdd9e1..3ba6a12a 100644 --- a/src/serverless/gtmGithubResults/gtmGithubResults.js +++ b/src/serverless/gtmGithubResults/gtmGithubResults.js @@ -1,5 +1,6 @@ 'use strict'; +console.log('cold start'); require('source-map-support').install(); let json = require('format-json'); let consumer = require('sqs-consumer');