updated site config files
This commit is contained in:
parent
00a3e9be23
commit
ac0c28b8f9
7 changed files with 56 additions and 41 deletions
|
@ -1,5 +1,5 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'config': path.resolve('config', 'sequelizeCliConfig.js'),
|
'config': path.resolve('devConfig', 'sequelizeCliConfig.js'),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
|
const logger = require('winston');
|
||||||
|
|
||||||
function MysqlConfig () {
|
function MysqlConfig () {
|
||||||
this.database = 'default';
|
this.database = 'default';
|
||||||
this.username = 'default';
|
this.username = 'default';
|
||||||
this.password = 'default';
|
this.password = 'default';
|
||||||
this.configure = ({database, username, password}) => {
|
this.configure = (config) => {
|
||||||
if (database) this.database = database;
|
if (!config) {
|
||||||
if (username) this.username = username;
|
return logger.warn('No MySQL config received.');
|
||||||
if (password) this.password = password;
|
}
|
||||||
|
const {database, username, password} = config;
|
||||||
|
this.database = database;
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,34 +1,40 @@
|
||||||
|
const logger = require('winston');
|
||||||
|
|
||||||
function SiteConfig () {
|
function SiteConfig () {
|
||||||
this.analytics = {
|
this.analytics = {
|
||||||
googleId: 'default',
|
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 = {
|
this.publishing = {
|
||||||
|
additionalClaimAddresses: [], // optional
|
||||||
|
disabled : false,
|
||||||
primaryClaimAddress : 'default',
|
primaryClaimAddress : 'default',
|
||||||
additionalClaimAddresses: [],
|
|
||||||
thumbnailChannel : 'default',
|
thumbnailChannel : 'default',
|
||||||
thumbnailChannelId : 'default',
|
thumbnailChannelId : 'default',
|
||||||
uploadDirectory : '/home/lbry/Uploads',
|
uploadDirectory : '/home/lbry/Uploads',
|
||||||
};
|
};
|
||||||
this.details = {
|
this.configure = (config) => {
|
||||||
title : 'Spee<h',
|
if (!config) {
|
||||||
name : 'Spee.ch',
|
return logger.warn('No site config received.');
|
||||||
host : 'https://dev1.spee.ch',
|
}
|
||||||
description: 'Open-source, decentralized image and video sharing.',
|
const {analytics, publishing, details, assetDefaults, auth} = config;
|
||||||
};
|
this.analytics = analytics;
|
||||||
this.assetDefaults = {
|
this.publishing = publishing;
|
||||||
title : 'dev1 Spee.ch',
|
this.details = details;
|
||||||
thumbnail : 'https://spee.ch/assets/img/video_thumb_default.png',
|
this.assetDefaults = assetDefaults;
|
||||||
description: 'Open-source, decentralized image and video sharing.',
|
this.auth = auth;
|
||||||
};
|
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
|
const logger = require('winston');
|
||||||
|
|
||||||
function SlackConfig () {
|
function SlackConfig () {
|
||||||
this.slackWebHook = 'default';
|
this.slackWebHook = 'default';
|
||||||
this.slackErrorChannel = 'default';
|
this.slackErrorChannel = 'default';
|
||||||
this.slackInfoChannel = 'default';
|
this.slackInfoChannel = 'default';
|
||||||
this.configure = ({slackWebHook, slackErrorChannel, slackInfoChannel}) => {
|
this.configure = (config) => {
|
||||||
if (slackWebHook) this.slackWebHook = slackWebHook;
|
if (!config) {
|
||||||
if (slackErrorChannel) this.slackErrorChannel = slackErrorChannel;
|
return logger.warn('No slack config received.');
|
||||||
if (slackInfoChannel) this.slackInfoChannel = slackInfoChannel;
|
}
|
||||||
|
const {slackWebHook, slackErrorChannel, slackInfoChannel} = config;
|
||||||
|
this.slackWebHook = slackWebHook;
|
||||||
|
this.slackErrorChannel = slackErrorChannel;
|
||||||
|
this.slackInfoChannel = slackInfoChannel;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
const ua = require('universal-analytics');
|
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) {
|
function createServeEventParams (headers, ip, originalUrl) {
|
||||||
return {
|
return {
|
||||||
|
@ -49,7 +49,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
sendGATimingEvent (category, variable, label, startTime, endTime) {
|
sendGATimingEvent (category, variable, label, startTime, endTime) {
|
||||||
const params = createPublishTimingEventParams(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 }) {
|
chooseGaLbrynetPublishLabel ({ channel_name: channelName, channel_id: channelId }) {
|
||||||
return (channelName || channelId ? 'PUBLISH_IN_CHANNEL_CLAIM' : 'PUBLISH_ANONYMOUS_CLAIM');
|
return (channelName || channelId ? 'PUBLISH_IN_CHANNEL_CLAIM' : 'PUBLISH_ANONYMOUS_CLAIM');
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
const { details: { title: siteTitle } } = require('../../config/siteConfig.js');
|
const { details: { title } } = require('../../config/siteConfig.js');
|
||||||
|
|
||||||
export const createPageTitle = (pageTitle) => {
|
export const createPageTitle = (pageTitle) => {
|
||||||
if (!pageTitle) {
|
if (!pageTitle) {
|
||||||
return `${siteTitle}`;
|
return `${title}`;
|
||||||
}
|
}
|
||||||
return `${siteTitle} - ${pageTitle}`;
|
return `${title} - ${pageTitle}`;
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,12 +13,9 @@ const logger = require('winston');
|
||||||
|
|
||||||
function SpeechServer ({ mysqlConfig, siteConfig, slackConfig }) {
|
function SpeechServer ({ mysqlConfig, siteConfig, slackConfig }) {
|
||||||
this.PORT = 3000;
|
this.PORT = 3000;
|
||||||
this.speak = (something) => {
|
|
||||||
console.log(something);
|
|
||||||
};
|
|
||||||
this.start = () => {
|
this.start = () => {
|
||||||
this.configureConfigFiles();
|
|
||||||
this.configureLogging();
|
this.configureLogging();
|
||||||
|
this.configureConfigFiles();
|
||||||
this.configureApp();
|
this.configureApp();
|
||||||
this.configureServer();
|
this.configureServer();
|
||||||
this.startServer();
|
this.startServer();
|
||||||
|
@ -61,7 +58,7 @@ function SpeechServer ({ mysqlConfig, siteConfig, slackConfig }) {
|
||||||
// initialize passport
|
// initialize passport
|
||||||
app.use(cookieSession({
|
app.use(cookieSession({
|
||||||
name : 'session',
|
name : 'session',
|
||||||
keys : [siteConfig.session.sessionKey],
|
keys : [siteConfig.auth.sessionKey],
|
||||||
maxAge: 24 * 60 * 60 * 1000, // i.e. 24 hours
|
maxAge: 24 * 60 * 60 * 1000, // i.e. 24 hours
|
||||||
}));
|
}));
|
||||||
app.use(passport.initialize());
|
app.use(passport.initialize());
|
||||||
|
|
Loading…
Add table
Reference in a new issue