summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYukai Huang2016-11-16 14:44:35 +0800
committerYukai Huang2016-11-16 14:44:42 +0800
commit2b2c5935312372e9be4ca092024fdd5ce691de7b (patch)
tree8a0daaca5440a70222a1236e95b2d551bf16bdbb /lib
parent7830184993a2624a2aae4515676d1324fab76594 (diff)
Config s3 through env variables
Diffstat (limited to 'lib')
-rw-r--r--lib/config.js13
1 files changed, 6 insertions, 7 deletions
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) ? {