Merge branch 'master' of github.com:mozilla/something-awesome
This commit is contained in:
commit
f870ab1ab8
2 changed files with 8 additions and 4 deletions
|
@ -84,9 +84,9 @@ app.get('/assets/download/:id', (req, res) => {
|
||||||
log.info('Deleted:', id);
|
log.info('Deleted:', id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
file_stream.pipe(res);
|
file_stream.pipe(res);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.sendStatus(404);
|
res.sendStatus(404);
|
||||||
|
@ -126,7 +126,9 @@ app.post('/upload/:id', (req, res, next) => {
|
||||||
req.pipe(req.busboy);
|
req.pipe(req.busboy);
|
||||||
req.busboy.on('file', (fieldname, file, filename) => {
|
req.busboy.on('file', (fieldname, file, filename) => {
|
||||||
log.info('Uploading:', req.params.id);
|
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 => {
|
storage.set(req.params.id, file, filename, url).then(linkAndID => {
|
||||||
res.json(linkAndID);
|
res.json(linkAndID);
|
||||||
|
|
|
@ -18,7 +18,9 @@ const mozlog = require('./log.js');
|
||||||
let log = mozlog('portal.storage');
|
let log = mozlog('portal.storage');
|
||||||
|
|
||||||
const redis = require('redis');
|
const redis = require('redis');
|
||||||
const redis_client = redis.createClient();
|
const redis_client = redis.createClient({
|
||||||
|
host: conf.redis_host
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
redis_client.on('error', err => {
|
redis_client.on('error', err => {
|
||||||
|
|
Loading…
Reference in a new issue