diff --git a/server/portal_server.js b/server/portal_server.js index af030d0a..b0143722 100644 --- a/server/portal_server.js +++ b/server/portal_server.js @@ -84,9 +84,9 @@ app.get('/assets/download/:id', (req, res) => { log.info('Deleted:', id); } }); - }); - file_stream.pipe(res); + file_stream.pipe(res); + }); }) .catch(err => { res.sendStatus(404); @@ -126,7 +126,9 @@ app.post('/upload/:id', (req, res, next) => { req.pipe(req.busboy); req.busboy.on('file', (fieldname, file, filename) => { log.info('Uploading:', req.params.id); - let url = `${req.protocol}://${req.get('host')}/download/${req.params.id}/`; + + const protocol = conf.env === 'development' ? req.protocol : 'https'; + let url = `${protocol}://${req.get('host')}/download/${req.params.id}/`; storage.set(req.params.id, file, filename, url).then(linkAndID => { res.json(linkAndID); diff --git a/server/storage.js b/server/storage.js index 81813336..99e1b39b 100644 --- a/server/storage.js +++ b/server/storage.js @@ -18,7 +18,9 @@ const mozlog = require('./log.js'); let log = mozlog('portal.storage'); const redis = require('redis'); -const redis_client = redis.createClient(); +const redis_client = redis.createClient({ + host: conf.redis_host +}); redis_client.on('error', err => {