Skip to content

Commit aa8f204

Browse files
authored
Merge pull request #111 from tbartelmess/master
Added the ability to specify the AWS endpoint
2 parents 34844bb + ed84ce2 commit aa8f204

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ The region the AWS `bucket` is located in.
104104

105105
*Default:* `undefined`
106106

107+
### endpoint
108+
109+
AWS (or AWS compatible endpoint) to use. E.g. with DigitalOcean Spaces, Microsoft Azure Blob Storage,
110+
or Openstack Swift
111+
112+
If `endpoint` set the `region` option will be ignored.
113+
114+
*Default:* `[region].s3.amazonaws.com`
115+
107116
### acl
108117

109118
The ACL to apply to the objects.

lib/s3.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module.exports = CoreObject.extend({
2727
const sessionToken = this.plugin.readConfig('sessionToken');
2828
const profile = this.plugin.readConfig('profile');
2929
const signatureVersion = this.plugin.readConfig('signatureVersion');
30+
const endpoint = this.plugin.readConfig('endpoint');
3031

3132
if (accessKeyId && secretAccessKey) {
3233
this.plugin.log('Using AWS access key id and secret access key from config', { verbose: true });
@@ -49,6 +50,11 @@ module.exports = CoreObject.extend({
4950
AWS.config.credentials = new AWS.SharedIniFileCredentials({ profile: profile });
5051
}
5152

53+
if (endpoint) {
54+
this.plugin.log('Using endpoint from config', { verbose: true });
55+
s3Options.endpoint = new AWS.Endpoint(endpoint);
56+
}
57+
5258
this._client = this.plugin.readConfig('s3Client') || new AWS.S3(s3Options);
5359
},
5460

0 commit comments

Comments
 (0)