Improve environment variable stuff
This commit is contained in:
parent
760ee07a2e
commit
6ba174cff0
16 changed files with 66 additions and 64 deletions
|
@ -1,7 +1,7 @@
|
|||
import moment from 'moment';
|
||||
import { sniff } from './type';
|
||||
|
||||
const fileHost = process.env.FILE_HOST || 'http://localhost:4040';
|
||||
const baseURL = process.env.WEB_BASE_URL;
|
||||
|
||||
export function formatDate(timestamp) {
|
||||
return moment.unix(timestamp).format('D MMM YY [at] h:mm A');
|
||||
|
@ -25,7 +25,7 @@ export function formatFile(file) {
|
|||
added: moment.unix(file.time_added).format(),
|
||||
readableAdded: formatDate(file.time_added),
|
||||
downloads: file.downloads !== undefined ? file.downloads : 0,
|
||||
href: fileHost + '/' + file._id, // eslint-disable-line no-underscore-dangle
|
||||
href: baseURL + '/' + file._id, // eslint-disable-line no-underscore-dangle
|
||||
id: file._id, // eslint-disable-line no-underscore-dangle
|
||||
name: file.file_name,
|
||||
size: file.file_size,
|
||||
|
@ -40,8 +40,8 @@ export function formatFile(file) {
|
|||
formattedFile.width = file.width;
|
||||
const ext = (file.file_name.split('.').pop().toLowerCase() === 'psd' ? '.png' : '');
|
||||
formattedFile.direct = {
|
||||
'150x': fileHost + '/file/150/' + file._id + '/' + file.file_name + ext, // eslint-disable-line no-underscore-dangle
|
||||
'970x': fileHost + '/file/970/' + file._id + '/' + file.file_name + ext, // eslint-disable-line no-underscore-dangle
|
||||
'150x': baseURL + '/file/150/' + file._id + '/' + file.file_name + ext, // eslint-disable-line no-underscore-dangle
|
||||
'970x': baseURL + '/file/970/' + file._id + '/' + file.file_name + ext, // eslint-disable-line no-underscore-dangle
|
||||
};
|
||||
}
|
||||
return formattedFile;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue