Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update aws-sdk to v3 #186

Merged
merged 2 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading