updated site config files

This commit is contained in:
bill bittner 2018-03-12 19:26:03 -07:00
parent 00a3e9be23
commit ac0c28b8f9
7 changed files with 56 additions and 41 deletions

View file

@ -1,5 +1,5 @@
const path = require('path');
module.exports = {
'config': path.resolve('config', 'sequelizeCliConfig.js'),
'config': path.resolve('devConfig', 'sequelizeCliConfig.js'),
}

View file

@ -1,11 +1,17 @@
const logger = require('winston');
function MysqlConfig () {
this.database = 'default';
this.username = 'default';
this.password = 'default';
this.configure = ({database, username, password}) => {
if (database) this.database = database;
if (username) this.username = username;
if (password) this.password = password;
this.configure = (config) => {
if (!config) {
return logger.warn('No MySQL config received.');
}
const {database, username, password} = config;
this.database = database;
this.username = username;
this.password = password;
};
};

View file

@ -1,34 +1,40 @@
const logger = require('winston');
function SiteConfig () {
this.analytics = {
googleId: 'default',
};
this.assetDefaults = {
title : 'Spee.ch',
thumbnail : 'https://spee.ch/assets/img/video_thumb_default.png',
description: 'Open-source, decentralized image and video sharing.',
};
this.auth = {
sessionKey: 'default',
};
this.details = {
title : 'Spee.h Dev1',
host : 'https://dev1.spee.ch',
description: 'Open-source, decentralized image and video sharing.',
};
this.publishing = {
additionalClaimAddresses: [], // optional
disabled : false,
primaryClaimAddress : 'default',
additionalClaimAddresses: [],
thumbnailChannel : 'default',
thumbnailChannelId : 'default',
uploadDirectory : '/home/lbry/Uploads',
};
this.details = {
title : 'Spee<h',
name : 'Spee.ch',
host : 'https://dev1.spee.ch',
description: 'Open-source, decentralized image and video sharing.',
};
this.assetDefaults = {
title : 'dev1 Spee.ch',
thumbnail : 'https://spee.ch/assets/img/video_thumb_default.png',
description: 'Open-source, decentralized image and video sharing.',
};
this.session = {
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;
this.configure = (config) => {
if (!config) {
return logger.warn('No site config received.');
}
const {analytics, publishing, details, assetDefaults, auth} = config;
this.analytics = analytics;
this.publishing = publishing;
this.details = details;
this.assetDefaults = assetDefaults;
this.auth = auth;
};
};

View file

@ -1,11 +1,17 @@
const logger = require('winston');
function SlackConfig () {
this.slackWebHook = 'default';
this.slackErrorChannel = 'default';
this.slackInfoChannel = 'default';
this.configure = ({slackWebHook, slackErrorChannel, slackInfoChannel}) => {
if (slackWebHook) this.slackWebHook = slackWebHook;
if (slackErrorChannel) this.slackErrorChannel = slackErrorChannel;
if (slackInfoChannel) this.slackInfoChannel = slackInfoChannel;
this.configure = (config) => {
if (!config) {
return logger.warn('No slack config received.');
}
const {slackWebHook, slackErrorChannel, slackInfoChannel} = config;
this.slackWebHook = slackWebHook;
this.slackErrorChannel = slackErrorChannel;
this.slackInfoChannel = slackInfoChannel;
};
};

View file

@ -1,6 +1,6 @@
const logger = require('winston');
const ua = require('universal-analytics');
const { analytics : { googleId }, details: { name: siteName } } = require('../config/siteConfig.js');
const { analytics : { googleId }, details: { title } } = require('../config/siteConfig.js');
function createServeEventParams (headers, ip, originalUrl) {
return {
@ -49,7 +49,7 @@ module.exports = {
},
sendGATimingEvent (category, variable, label, startTime, endTime) {
const params = createPublishTimingEventParams(category, variable, label, startTime, endTime);
sendGoogleAnalyticsTiming(siteName, params);
sendGoogleAnalyticsTiming(title, params);
},
chooseGaLbrynetPublishLabel ({ channel_name: channelName, channel_id: channelId }) {
return (channelName || channelId ? 'PUBLISH_IN_CHANNEL_CLAIM' : 'PUBLISH_ANONYMOUS_CLAIM');

View file

@ -1,8 +1,8 @@
const { details: { title: siteTitle } } = require('../../config/siteConfig.js');
const { details: { title } } = require('../../config/siteConfig.js');
export const createPageTitle = (pageTitle) => {
if (!pageTitle) {
return `${siteTitle}`;
return `${title}`;
}
return `${siteTitle} - ${pageTitle}`;
return `${title} - ${pageTitle}`;
};

View file

@ -13,12 +13,9 @@ const logger = require('winston');
function SpeechServer ({ mysqlConfig, siteConfig, slackConfig }) {
this.PORT = 3000;
this.speak = (something) => {
console.log(something);
};
this.start = () => {
this.configureConfigFiles();
this.configureLogging();
this.configureConfigFiles();
this.configureApp();
this.configureServer();
this.startServer();
@ -61,7 +58,7 @@ function SpeechServer ({ mysqlConfig, siteConfig, slackConfig }) {
// initialize passport
app.use(cookieSession({
name : 'session',
keys : [siteConfig.session.sessionKey],
keys : [siteConfig.auth.sessionKey],
maxAge: 24 * 60 * 60 * 1000, // i.e. 24 hours
}));
app.use(passport.initialize());