updated siteConfig to be a constructor

This commit is contained in:
bill bittner 2018-03-09 18:30:06 -08:00
parent 0e9455278e
commit 532702c095
2 changed files with 22 additions and 14 deletions

View file

@ -1,26 +1,35 @@
module.exports = { function SiteConfig () {
analytics: { this.analytics = {
googleId: 'default', googleId: 'default',
}, };
publishing: { this.publishing = {
primaryClaimAddress : 'default', primaryClaimAddress : 'default',
additionalClaimAddresses: [], additionalClaimAddresses: [],
thumbnailChannel : 'default', thumbnailChannel : 'default',
thumbnailChannelId : 'default', thumbnailChannelId : 'default',
uploadDirectory : '/home/lbry/Uploads', uploadDirectory : '/home/lbry/Uploads',
}, };
details: { this.details = {
title : 'Spee<h', title : 'Spee<h',
name : 'Spee.ch', name : 'Spee.ch',
host : 'https://dev1.spee.ch', host : 'https://dev1.spee.ch',
description: 'Open-source, decentralized image and video sharing.', description: 'Open-source, decentralized image and video sharing.',
}, };
assetDefaults: { this.assetDefaults = {
title : 'dev1 Spee.ch', title : 'dev1 Spee.ch',
thumbnail : 'https://spee.ch/assets/img/video_thumb_default.png', thumbnail : 'https://spee.ch/assets/img/video_thumb_default.png',
description: 'Open-source, decentralized image and video sharing.', description: 'Open-source, decentralized image and video sharing.',
}, };
session: { this.session = {
sessionKey: 'default', sessionKey: 'default',
}, };
this.configure = ({analytics, publishing, details, assetDefaults, session}) => {
if (analytics) this.analytics = analytics;
if (publishing) this.publishing = publishing;
if (details) this.details = details;
if (assetDefaults) this.assetDefaults = assetDefaults;
if (session) this.session = session;
};
}; };
module.exports = new SiteConfig();

View file

@ -26,11 +26,10 @@ function SpeechServer ({ mysqlConfig, siteConfig, slackConfig }) {
this.configureConfigFiles = () => { this.configureConfigFiles = () => {
const mysqlAppConfig = require('./config/mysqlConfig.js'); const mysqlAppConfig = require('./config/mysqlConfig.js');
mysqlAppConfig.configure(mysqlConfig); mysqlAppConfig.configure(mysqlConfig);
const siteAppConfig = require('./config/siteConfig.js');
siteAppConfig.configure(siteConfig);
const slackAppConfig = require('./config/slackConfig.js'); const slackAppConfig = require('./config/slackConfig.js');
slackAppConfig.configure(slackConfig); slackAppConfig.configure(slackConfig);
// // print the config variables
// require('./helpers/configVarCheck.js')(mysqlAppConfig);
// require('./helpers/configVarCheck.js')(slackAppConfig);
}; };
this.configureLogging = () => { this.configureLogging = () => {
require('./helpers/configureLogger.js')(logger); require('./helpers/configureLogger.js')(logger);