From 7ad86f6dbb65941f9c7aa49a1938e1a0a5bb7d50 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 10 May 2018 18:30:55 +0200 Subject: dont hardcode s3 path --- bucky/db/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bucky/db/index.js') diff --git a/bucky/db/index.js b/bucky/db/index.js index 51c024b..5e21603 100644 --- a/bucky/db/index.js +++ b/bucky/db/index.js @@ -172,8 +172,8 @@ db.destroyFile = function(id){ } db.moveFile = function(file, thread_id){ var s3client = upload.client() - var srcPath = '/bucky/data/' + file.get('thread') + '/' + file.get('filename') - var destPath = '/bucky/data/' + thread_id + '/' + file.get('filename') + var srcPath = process.env.S3_PATH + '/data/' + file.get('thread') + '/' + file.get('filename') + var destPath = process.env.S3_PATH + '/data/' + thread_id + '/' + file.get('filename') console.log('moving', srcPath, 'to', destPath) var copyPromise = new Promise((resolve, reject) => { s3client.copy(srcPath, destPath).on('response', function(res){ @@ -207,7 +207,7 @@ db.destroyFiles = function(files){ if (! thread_id || ! filename) { return resolve() } - var filePath = '/bucky/data/' + thread_id + '/' + filename + var filePath = process.env.S3_PATH + '/data/' + thread_id + '/' + filename console.log('delete', filePath) s3client.deleteFile(filePath, function(err, res){ // check `err`, then do `res.pipe(..)` or `res.resume()` or whatever. -- cgit v1.2.3-70-g09d2