added separate views config file

This commit is contained in:
bill bittner 2018-05-02 10:30:33 -07:00
parent 832e18072b
commit 18eaf81579
4 changed files with 21 additions and 16 deletions

View file

@ -10,9 +10,6 @@ function SiteConfig () {
this.auth = { this.auth = {
sessionKey: 'default', sessionKey: 'default',
}; };
this.customComponents = {};
this.customContainers = {};
this.customPages = {};
this.details = { this.details = {
description: 'Welcome to my decentralized image and video sharing site.', description: 'Welcome to my decentralized image and video sharing site.',
host : 'http://localhost:3000', host : 'http://localhost:3000',
@ -29,22 +26,17 @@ function SiteConfig () {
thumbnailChannelId : 'default', thumbnailChannelId : 'default',
uploadDirectory : '/home/lbry/Uploads', uploadDirectory : '/home/lbry/Uploads',
}; };
this.routes = {};
this.update = (config) => { this.update = (config) => {
if (!config) { if (!config) {
return console.log('No site config received.'); return console.log('No site config received.');
} }
const { analytics, assetDefaults, auth, customComponents, customContainers, customPages, details, publishing, routes } = config; const { analytics, assetDefaults, auth, details, publishing } = config;
console.log('Configuring site details...'); console.log('Configuring site details...');
this.analytics = analytics; this.analytics = analytics;
this.assetDefaults = assetDefaults; this.assetDefaults = assetDefaults;
this.auth = auth; this.auth = auth;
this.details = details; this.details = details;
this.publishing = publishing; this.publishing = publishing;
this.customComponents = customComponents;
this.customContainers = customContainers;
this.customPages = customPages;
this.routes = routes;
}; };
} }

View file

@ -28,7 +28,7 @@ function SlackConfig () {
iconEmoji : ':face_with_head_bandage:', iconEmoji : ':face_with_head_bandage:',
}); });
}; };
if (slackInfoChannel) { if (this.slackInfoChannel) {
winston.add(winstonSlackWebHook, { winston.add(winstonSlackWebHook, {
name : 'slack-info-transport', name : 'slack-info-transport',
level : 'info', level : 'info',

17
config/viewsConfig.js Normal file
View file

@ -0,0 +1,17 @@
function ViewsConfig () {
this.components = {};
this.containers = {};
this.pages = {};
this.update = (config) => {
if (!config) {
return console.log('No components config received.');
}
const { components, containers, pages } = config;
console.log('Configuring custom components ...');
this.components = components;
this.containers = containers;
this.pages = pages;
};
}
module.exports = new ViewsConfig();

View file

@ -13,18 +13,14 @@ const loggerConfig = require('./config/loggerConfig.js');
const mysqlConfig = require('./config/mysqlConfig.js'); const mysqlConfig = require('./config/mysqlConfig.js');
const siteConfig = require('./config/siteConfig.js'); const siteConfig = require('./config/siteConfig.js');
const slackConfig = require('./config/slackConfig.js'); const slackConfig = require('./config/slackConfig.js');
const viewsConfig = require('./config/viewsConfig.js');
function Server () { function Server () {
this.configureLogger = loggerConfig.update; this.configureLogger = loggerConfig.update;
this.configureMysql = mysqlConfig.update; this.configureMysql = mysqlConfig.update;
this.configureSite = siteConfig.update; this.configureSite = siteConfig.update;
this.configureSlack = slackConfig.update; this.configureSlack = slackConfig.update;
this.configureModels = () => { this.configureViews = viewsConfig.update;
logger.debug('here is where you could add/overwrite the default models')
};
this.configureRoutes = () => {
logger.debug('here is where you could add/overwrite the default routes')
};
this.createApp = () => { this.createApp = () => {
// create an Express application // create an Express application
const app = express(); const app = express();