Skip to content

Commit

Permalink
Merge pull request #186 from gorner/aws-v3
Browse files Browse the repository at this point in the history
Update aws-sdk to v3
  • Loading branch information
lukemelia committed Mar 22, 2024
2 parents 3cd10c9 + cda50c9 commit fb7016c
Show file tree
Hide file tree
Showing 3 changed files with 1,196 additions and 180 deletions.
16 changes: 12 additions & 4 deletions lib/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ var _ = require('lodash');
module.exports = CoreObject.extend({
init: function(options) {
this._super(options);
var AWS = require('aws-sdk');

const {
fromIni
} = require('@aws-sdk/credential-providers');

const {
S3
} = require('@aws-sdk/client-s3');

var s3Options = {
region: this.plugin.readConfig('region')
};
Expand Down Expand Up @@ -54,15 +62,15 @@ module.exports = CoreObject.extend({

if (profile && !this.plugin.readConfig('s3Client')) {
this.plugin.log('Using AWS profile from config', { verbose: true });
AWS.config.credentials = new AWS.SharedIniFileCredentials({ profile: profile });
s3Options.credentials = fromIni({ profile: profile });
}

if (endpoint) {
this.plugin.log('Using endpoint from config', { verbose: true });
s3Options.endpoint = new AWS.Endpoint(endpoint);
s3Options.endpoint = endpoint;
}

this._client = this.plugin.readConfig('s3Client') || new AWS.S3(s3Options);
this._client = this.plugin.readConfig('s3Client') || new S3(s3Options);
},

upload: function(options) {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"test": "node tests/runner.js && ./node_modules/.bin/eslint index.js lib/* tests/**/*-test.js"
},
"dependencies": {
"aws-sdk": "^2.1354.0",
"@aws-sdk/client-s3": "^3.525.0",
"@aws-sdk/credential-providers": "^3.525.0",
"chalk": "^4.1.0",
"core-object": "^3.1.5",
"ember-cli-deploy-plugin": "^0.2.9",
Expand Down
Loading

0 comments on commit fb7016c

Please sign in to comment.