summaryrefslogtreecommitdiff
path: root/app/node_modules
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2016-04-05 14:40:46 -0400
committerJules Laplace <jules@okfoc.us>2016-04-05 14:40:46 -0400
commit62ce072b3c32bacf3d290b44bf1b9db8154d30a7 (patch)
treebe0d814fc09eab6e6605ee0886ff51133a619854 /app/node_modules
parent56580705e3a62eaf1c498c1c0456fc33fe3b2f76 (diff)
configuration options
Diffstat (limited to 'app/node_modules')
-rw-r--r--app/node_modules/okservices/oks3/index.js27
1 files changed, 24 insertions, 3 deletions
diff --git a/app/node_modules/okservices/oks3/index.js b/app/node_modules/okservices/oks3/index.js
index dc0ca19..97abef0 100644
--- a/app/node_modules/okservices/oks3/index.js
+++ b/app/node_modules/okservices/oks3/index.js
@@ -14,6 +14,20 @@ function OKS3(options) {
throw new Error('Express not provided to OKS3');
if (!options.s3)
throw new Error('S3 configuration not provided to OKS3');
+
+ if (!options.s3.image) options.s3.image = {}
+ if (!options.s3.audio) options.s3.audio = {}
+ if (!options.s3.video) options.s3.video = {}
+
+ if (options.s3.maxbytes) {
+ if (! ('maxbytes' in options.s3.image))
+ options.s3.image.maxbytes = options.s3.maxbytes
+ if (! ('maxbytes' in options.s3.video))
+ options.s3.video.maxbytes = options.s3.maxbytes
+ if (! ('maxbytes' in options.s3.audio))
+ options.s3.audio.maxbytes = options.s3.maxbytes
+ }
+
var express = options.express;
var router = express.Router();
@@ -30,7 +44,8 @@ function OKS3(options) {
secret: options.s3.secret,
bucket: options.s3.bucket,
dirname: options.s3.dirname,
- maxBytes: options.s3.maxbytes,
+ maxBytes: options.s3.image.maxbytes,
+ saveAs: options.s3.image.preserveFilename && preserveFilename,
headers: {
'x-amz-acl': 'public-read'
}
@@ -52,7 +67,8 @@ function OKS3(options) {
secret: options.s3.secret,
bucket: options.s3.bucket,
dirname: options.s3.dirname,
- maxBytes: options.s3.maxbytesAudio,
+ maxBytes: options.s3.audio.maxbytes,
+ saveAs: options.s3.audio.preserveFilename && preserveFilename,
headers: {
'x-amz-acl': 'public-read'
}
@@ -74,7 +90,8 @@ function OKS3(options) {
secret: options.s3.secret,
bucket: options.s3.bucket,
dirname: options.s3.dirname,
- maxBytes: options.s3.maxbytesVideo,
+ maxBytes: options.s3.video.maxbytes,
+ saveAs: options.s3.video.preserveFilename && preserveFilename,
headers: {
'x-amz-acl': 'public-read'
}
@@ -84,6 +101,10 @@ function OKS3(options) {
});
});
});
+
+ function preserveFilename (stream, cb){
+ cb(null, stream.filename)
+ }
this._middleware = router;
}