①mod_file.js exports.createS3Obj = function(name, key) { + var proxy = require("proxy-agent"); + AWS.config.update({ + httpOptions: { + agent: proxy("http://10.1.1.7:8080") + } + }); var cp = new AWS.CredentialProviderChain(); var bucket = process.env.AWS_BUCKET.toLowerCase().replace(/_/g, "."); return new AWS.S3({ params: {Bucket: bucket, Key: ["S3", name, key].join("/") }, credentialProvider:cp}); };
②node_modules/collie-modules-file/lib/s3/index.js S3.prototype.open = function (key) { var proxy = require("proxy-agent"); AWS.config.update({ httpOptions: { agent: proxy("http://10.1.1.7:8080") } }); var cp = new AWS.CredentialProviderChain(); return new AWS.S3({params: {Bucket: this.bucket, Key: this.pathname(key)}, credentialProvider:cp}); };