Skip to content

Commit

Permalink
fix: try to get proxy to s3 to work (#210)
Browse files Browse the repository at this point in the history
* fix: try to get proxy to s3 to work

* chore: modify test to make unique tmp dir
  • Loading branch information
peternhale authored Jun 24, 2021
1 parent 9e499c5 commit 2f83ada
Show file tree
Hide file tree
Showing 3 changed files with 170 additions and 163 deletions.
5 changes: 4 additions & 1 deletion src/codeSigning/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import ClientConfiguration = WebIdentityCredentials.ClientConfiguration;
export async function putObject(bucket: string, key: string, body: string): Promise<AWS.S3.PutObjectOutput> {
return new Promise((resolve, reject) => {
const agent = api.getAgentForUri('https://s3.amazonaws.com') as Agents;
const s3 = new AWS.S3({ httpsOptions: { agent: agent.https } } as ClientConfiguration);
const s3 = new AWS.S3({
httpOptions: { agent: agent.http },
httpsOptions: { agent: agent.https },
} as ClientConfiguration);
s3.putObject({ Bucket: bucket, Key: key, Body: body }, (err, resp) => {
if (err) reject(err);
if (resp) resolve(resp);
Expand Down
8 changes: 6 additions & 2 deletions test/registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ describe('registry tests', () => {
});
describe('npmrc tests', () => {
let packageDir;
beforeEach(() => {
packageDir = os.tmpdir();
before(() => {
packageDir = path.join(os.tmpdir(), new Date().getMilliseconds().toString());
fs.mkdirpSync(packageDir);
});
afterEach(() => {
if (fs.fileExistsSync(path.join(packageDir, '.npmrc'))) {
fs.unlinkSync(path.join(packageDir, '.npmrc'));
}
});
after(async () => {
await fs.remove(packageDir);
});
it('should NOT WRITE npmrc registry for registry defaults', async () => {
$$.SANDBOX.stub(Env.prototype, 'getString').returns(undefined);
const registry = new Registry();
Expand Down
Loading

0 comments on commit 2f83ada

Please sign in to comment.