From a5dad2930037b466542f1e77d3cbb0d0cbf184aa Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Mon, 14 Nov 2016 17:07:07 +0800 Subject: support filesystem image upload --- lib/config.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/config.js b/lib/config.js index 76b21f0d..001cc8fa 100644 --- a/lib/config.js +++ b/lib/config.js @@ -56,6 +56,9 @@ var heartbeattimeout = config.heartbeattimeout || 10000; // document var documentmaxlength = config.documentmaxlength || 100000; +// image upload setting, available options are imgur/s3/filesystem +var imageUploadType = config.imageUploadType || 'imgur'; + // auth var facebook = (process.env.HMD_FACEBOOK_CLIENTID && process.env.HMD_FACEBOOK_CLIENTSECRET) ? { clientID: process.env.HMD_FACEBOOK_CLIENTID, @@ -139,5 +142,6 @@ module.exports = { gitlab: gitlab, dropbox: dropbox, google: google, - imgur: imgur + imgur: imgur, + imageUploadType: imageUploadType }; -- cgit v1.2.3 From 518a4a120b1fe30953b6b526da1eff826484aee0 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 16 Nov 2016 12:05:24 +0800 Subject: upload image to s3 --- lib/config.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/config.js b/lib/config.js index 001cc8fa..ecc68f75 100644 --- a/lib/config.js +++ b/lib/config.js @@ -59,6 +59,15 @@ var documentmaxlength = config.documentmaxlength || 100000; // image upload setting, available options are imgur/s3/filesystem var imageUploadType = config.imageUploadType || 'imgur'; +var s3Keys = ['accessKeyId', 'secretAccessKey', 'region']; +config.s3 = config.s3 || {}; +var s3 = s3Keys.reduce(function(prev, cur) { + prev[cur] = config.s3[cur]; + return prev; +}, {}); + +var s3bucket = config.s3.bucket; + // auth var facebook = (process.env.HMD_FACEBOOK_CLIENTID && process.env.HMD_FACEBOOK_CLIENTSECRET) ? { clientID: process.env.HMD_FACEBOOK_CLIENTID, @@ -143,5 +152,7 @@ module.exports = { dropbox: dropbox, google: google, imgur: imgur, - imageUploadType: imageUploadType + imageUploadType: imageUploadType, + s3: s3, + s3bucket: s3bucket }; -- cgit v1.2.3 From 2b2c5935312372e9be4ca092024fdd5ce691de7b Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 16 Nov 2016 14:44:35 +0800 Subject: Config s3 through env variables --- lib/config.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/config.js b/lib/config.js index ecc68f75..99b94279 100644 --- a/lib/config.js +++ b/lib/config.js @@ -59,14 +59,13 @@ var documentmaxlength = config.documentmaxlength || 100000; // image upload setting, available options are imgur/s3/filesystem var imageUploadType = config.imageUploadType || 'imgur'; -var s3Keys = ['accessKeyId', 'secretAccessKey', 'region']; config.s3 = config.s3 || {}; -var s3 = s3Keys.reduce(function(prev, cur) { - prev[cur] = config.s3[cur]; - return prev; -}, {}); - -var s3bucket = config.s3.bucket; +var s3 = { + accessKeyId: process.env.S3_ACCESS_KEY_ID || config.s3.accessKeyId, + secretAccessKey: process.env.S3_SECRET_ACCESS_KEY || config.s3.secretAccessKey, + region: process.env.S3_REGION || config.s3.region +} +var s3bucket = process.env.S3_BUCKET || config.s3.bucket; // auth var facebook = (process.env.HMD_FACEBOOK_CLIENTID && process.env.HMD_FACEBOOK_CLIENTSECRET) ? { -- cgit v1.2.3 From 46a4fe10abdec2cfb102336c8f6971eb7202b08b Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Thu, 17 Nov 2016 16:28:02 +0800 Subject: Add env config prefix --- lib/config.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/config.js b/lib/config.js index 99b94279..a906dfa4 100644 --- a/lib/config.js +++ b/lib/config.js @@ -57,15 +57,15 @@ var heartbeattimeout = config.heartbeattimeout || 10000; var documentmaxlength = config.documentmaxlength || 100000; // image upload setting, available options are imgur/s3/filesystem -var imageUploadType = config.imageUploadType || 'imgur'; +var imageUploadType = process.env.HMD_IMAGE_UPLOAD_TYPE || config.imageUploadType || 'imgur'; config.s3 = config.s3 || {}; var s3 = { - accessKeyId: process.env.S3_ACCESS_KEY_ID || config.s3.accessKeyId, - secretAccessKey: process.env.S3_SECRET_ACCESS_KEY || config.s3.secretAccessKey, - region: process.env.S3_REGION || config.s3.region + accessKeyId: process.env.HMD_S3_ACCESS_KEY_ID || config.s3.accessKeyId, + secretAccessKey: process.env.HMD_S3_SECRET_ACCESS_KEY || config.s3.secretAccessKey, + region: process.env.HMD_S3_REGION || config.s3.region } -var s3bucket = process.env.S3_BUCKET || config.s3.bucket; +var s3bucket = process.env.HMD_S3_BUCKET || config.s3.bucket; // auth var facebook = (process.env.HMD_FACEBOOK_CLIENTID && process.env.HMD_FACEBOOK_CLIENTSECRET) ? { -- cgit v1.2.3