switched hard coding for configs

This commit is contained in:
bill bittner 2018-07-31 09:20:56 -07:00
parent 995d3f138b
commit f42cc51d12

View file

@ -2,12 +2,19 @@ const logger = require('winston');
const db = require('../../../models');
const getClaimId = require('../../utils/getClaimId');
const {
details: {
host,
title: siteTitle,
},
} = require('@config/siteConfig');
const getOEmbedDataForAsset = (channelName, channelClaimId, claimName, claimId) => {
let fileData, claimData;
let data = {
version : '1.0',
provider_name: 'Spee.ch',
provider_url : 'https://spee.ch',
provider_name: siteTitle,
provider_url : host,
cache_age : 86400, // one day in seconds
};
@ -36,7 +43,7 @@ const getOEmbedDataForAsset = (channelName, channelClaimId, claimName, claimId)
.then(fileRecord => {
fileData = fileRecord.dataValues;
logger.debug('file data:', fileData);
const serveUrl = `https://dev1.spee.ch/${fileData.claimId}/${fileData.name}.${fileData.fileType.substring(fileData.fileType.indexOf('/') + 1)}`;
const serveUrl = `${host}/${fileData.claimId}/${fileData.name}.${fileData.fileType.substring(fileData.fileType.indexOf('/') + 1)}`;
// set the resource type
if (fileData.fileType === 'video/mp4') {
data['type'] = 'video';
@ -49,8 +56,8 @@ const getOEmbedDataForAsset = (channelName, channelClaimId, claimName, claimId)
data['title'] = claimData.title;
data['width'] = fileData.width || 600;
data['height'] = fileData.height || 400;
data['author_name'] = 'Spee.ch';
data['author_url'] = 'https://spee.ch';
data['author_name'] = siteTitle;
data['author_url'] = host;
})
.then(() => {
return data;