Skip to content

Commit

Permalink
fix: add proxy support for aws upload (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
peternhale authored Jun 15, 2021
1 parent ea9a308 commit 9a3bbd7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/codeSigning/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
import { basename } from 'path';
import { fs } from '@salesforce/core';
import * as AWS from 'aws-sdk';
import { Agents } from 'got';
import { WebIdentityCredentials } from 'aws-sdk';
import { api } from '../codeSigning/packAndSign';
import ClientConfiguration = WebIdentityCredentials.ClientConfiguration;

export async function putObject(bucket: string, key: string, body: string): Promise<AWS.S3.PutObjectOutput> {
return new Promise((resolve, reject) => {
const s3 = new AWS.S3();
const agent = api.getAgentForUri('https://s3.amazonaws.com') as Agents;
const s3 = new AWS.S3({ httpsOptions: { agent: [agent.http, agent.https] } } as ClientConfiguration);
s3.putObject({ Bucket: bucket, Key: key, Body: body }, (err, resp) => {
if (err) reject(err);
if (resp) resolve(resp);
Expand Down

0 comments on commit 9a3bbd7

Please sign in to comment.