added environment variable for expire time
This commit is contained in:
parent
fa1f0208a4
commit
4cb040d70d
6 changed files with 12 additions and 5 deletions
|
@ -41,6 +41,11 @@ const conf = convict({
|
|||
format: Number,
|
||||
default: 1024 * 1024 * 1024 * 2,
|
||||
env: 'P2P_MAX_FILE_SIZE'
|
||||
},
|
||||
expire_seconds: {
|
||||
format: Number,
|
||||
default: 86400,
|
||||
env: 'EXPIRE_SECONDS'
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ app.get('/jsconfig.js', (req, res) => {
|
|||
trackerId: conf.analytics_id,
|
||||
dsn: conf.sentry_id,
|
||||
maxFileSize: conf.max_file_size,
|
||||
expireSeconds: conf.expire_seconds,
|
||||
layout: false
|
||||
});
|
||||
});
|
||||
|
|
|
@ -152,7 +152,7 @@ function localSet(newId, file, filename, meta) {
|
|||
});
|
||||
fstream.on('finish', () => {
|
||||
redis_client.hmset(newId, meta);
|
||||
redis_client.expire(newId, 86400000);
|
||||
redis_client.expire(newId, conf.expire_seconds);
|
||||
log.info('localSet:', 'Upload Finished of ' + newId);
|
||||
resolve(meta.delete);
|
||||
});
|
||||
|
@ -238,7 +238,7 @@ function awsSet(newId, file, filename, meta) {
|
|||
return upload.promise().then(
|
||||
() => {
|
||||
redis_client.hmset(newId, meta);
|
||||
redis_client.expire(newId, 86400000);
|
||||
redis_client.expire(newId, conf.expire_seconds);
|
||||
log.info('awsUploadFinish', 'Upload Finished of ' + filename);
|
||||
},
|
||||
err => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue