added separate views config file
This commit is contained in:
parent
832e18072b
commit
18eaf81579
4 changed files with 21 additions and 16 deletions
|
@ -10,9 +10,6 @@ function SiteConfig () {
|
|||
this.auth = {
|
||||
sessionKey: 'default',
|
||||
};
|
||||
this.customComponents = {};
|
||||
this.customContainers = {};
|
||||
this.customPages = {};
|
||||
this.details = {
|
||||
description: 'Welcome to my decentralized image and video sharing site.',
|
||||
host : 'http://localhost:3000',
|
||||
|
@ -29,22 +26,17 @@ function SiteConfig () {
|
|||
thumbnailChannelId : 'default',
|
||||
uploadDirectory : '/home/lbry/Uploads',
|
||||
};
|
||||
this.routes = {};
|
||||
this.update = (config) => {
|
||||
if (!config) {
|
||||
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...');
|
||||
this.analytics = analytics;
|
||||
this.assetDefaults = assetDefaults;
|
||||
this.auth = auth;
|
||||
this.details = details;
|
||||
this.publishing = publishing;
|
||||
this.customComponents = customComponents;
|
||||
this.customContainers = customContainers;
|
||||
this.customPages = customPages;
|
||||
this.routes = routes;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ function SlackConfig () {
|
|||
iconEmoji : ':face_with_head_bandage:',
|
||||
});
|
||||
};
|
||||
if (slackInfoChannel) {
|
||||
if (this.slackInfoChannel) {
|
||||
winston.add(winstonSlackWebHook, {
|
||||
name : 'slack-info-transport',
|
||||
level : 'info',
|
||||
|
|
17
config/viewsConfig.js
Normal file
17
config/viewsConfig.js
Normal 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();
|
8
index.js
8
index.js
|
@ -13,18 +13,14 @@ const loggerConfig = require('./config/loggerConfig.js');
|
|||
const mysqlConfig = require('./config/mysqlConfig.js');
|
||||
const siteConfig = require('./config/siteConfig.js');
|
||||
const slackConfig = require('./config/slackConfig.js');
|
||||
const viewsConfig = require('./config/viewsConfig.js');
|
||||
|
||||
function Server () {
|
||||
this.configureLogger = loggerConfig.update;
|
||||
this.configureMysql = mysqlConfig.update;
|
||||
this.configureSite = siteConfig.update;
|
||||
this.configureSlack = slackConfig.update;
|
||||
this.configureModels = () => {
|
||||
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.configureViews = viewsConfig.update;
|
||||
this.createApp = () => {
|
||||
// create an Express application
|
||||
const app = express();
|
||||
|
|
Loading…
Reference in a new issue