Last active
January 18, 2018 12:04
-
-
Save johnparn/7f512cb3198f29ed245bc440915951d9 to your computer and use it in GitHub Desktop.
Diff of /storage-adapter/packages/oc-s3-storage-adapter/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/packages/oc-s3-storage-adapter/index.js b/packages/oc-s3-storage-adapter/index.js | |
index d6a552c..aebc7ed 100644 | |
--- a/packages/oc-s3-storage-adapter/index.js | |
+++ b/packages/oc-s3-storage-adapter/index.js | |
@@ -27,26 +27,42 @@ module.exports = function(conf) { | |
return true; | |
}; | |
+ // Defaults | |
+ const bucket = (conf.bucket) ? conf.bucket : ''; | |
+ const sslEnabled = (conf.sslEnabled === false) ? {sslEnabled: false} : {}; | |
+ const signatureVersion = (conf.signatureVersion) ? {signatureVersion: conf.signatureVersion} : {}; | |
const httpOptions = { timeout: conf.timeout || 10000 }; | |
if (conf.agentProxy) { | |
httpOptions.agent = conf.agentProxy; | |
} | |
- AWS.config.update({ | |
+ // Setup AWS config | |
+ let awsConfig = new AWS.Config({ | |
accessKeyId: conf.key, | |
secretAccessKey: conf.secret, | |
- region: conf.region, | |
- httpOptions | |
+ ...signatureVersion, | |
+ ...sslEnabled, | |
+ ...httpOptions | |
}); | |
- const bucket = conf.bucket; | |
+ // Setup endpoint | |
+ if (conf.endpoint) { | |
+ let awsEndpoint = new AWS.Endpoint(conf.endpoint.hostname); | |
+ awsEndpoint.port = conf.endpoint.port; | |
+ awsEndpoint.protocol = conf.endpoint.protocol; | |
+ | |
+ awsConfig.update({ | |
+ endpoint: awsEndpoint | |
+ }); | |
+ } | |
+ | |
const cache = new Cache({ | |
verbose: !!conf.verbosity, | |
refreshInterval: conf.refreshInterval | |
}); | |
- const getClient = () => new AWS.S3(); | |
- | |
+ const getClient = () => new AWS.S3( awsConfig ); | |
+ | |
const getFile = (filePath, force, callback) => { | |
if (_.isFunction(force)) { | |
callback = force; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/packages/oc-s3-storage-adapter/package.json b/packages/oc-s3-storage-adapter/package.json | |
index 34dcb9e..d3d3c11 100644 | |
--- a/packages/oc-s3-storage-adapter/package.json | |
+++ b/packages/oc-s3-storage-adapter/package.json | |
@@ -23,7 +23,7 @@ | |
"license": "MIT", | |
"dependencies": { | |
"async": "^2.5.0", | |
- "aws-sdk": "^2.137.0", | |
+ "aws-sdk": "^2.184.0", |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment