fixed config files

This commit is contained in:
bill bittner 2018-03-19 15:34:32 -07:00
parent 701c8f9bef
commit 11cc91ac05
23 changed files with 10989 additions and 85 deletions

4
.gitignore vendored
View file

@ -4,7 +4,9 @@ config/lbryConfig.js
config/loggerConfig.js config/loggerConfig.js
config/mysqlConfig.js config/mysqlConfig.js
config/siteConfig.js config/siteConfig.js
config/slackConfig.js
devConfig/slackConfig.js devConfig/slackConfig.js
devConfig/sequelizeCliConfig.js devConfig/sequelizeCliConfig.js
devConfig/testingConfig.js devConfig/testingConfig.js
public/bundle/
index.js

View file

@ -1,7 +1,5 @@
function MysqlConfig () { module.exports = {
this.database = 'default'; database: 'default',
this.username = 'default'; username: 'default',
this.password = 'default'; password: 'default',
}; };
module.exports = new MysqlConfig();

View file

@ -1,23 +1,23 @@
function SiteConfig () { module.exports = {
this.analytics = { analytics: {
googleId: 'default', googleId: 'default',
}; },
this.assetDefaults = { assetDefaults: {
description: 'An asset published on Spee.ch', description: 'An asset published on Spee.ch',
thumbnail : 'https://spee.ch/assets/img/video_thumb_default.png', thumbnail : 'https://spee.ch/assets/img/video_thumb_default.png',
title : 'Spee.ch', title : 'Spee.ch',
}; },
this.auth = { auth: {
sessionKey: 'default', sessionKey: 'default',
}; },
this.details = { details: {
description: 'Open-source, decentralized image and video sharing.', description: 'Open-source, decentralized image and video sharing.',
host : 'default', host : 'default',
port : 3000, port : 3000,
title : 'Spee.ch', title : 'Spee.ch',
twitter : '@spee_ch', twitter : '@spee_ch',
}; },
this.publishing = { publishing: {
additionalClaimAddresses: [], additionalClaimAddresses: [],
disabled : false, disabled : false,
disabledMessage : 'Please check back soon.', disabledMessage : 'Please check back soon.',
@ -25,7 +25,5 @@ function SiteConfig () {
thumbnailChannel : 'default', thumbnailChannel : 'default',
thumbnailChannelId : 'default', thumbnailChannelId : 'default',
uploadDirectory : '/home/lbry/Uploads', uploadDirectory : '/home/lbry/Uploads',
}; },
}; };
module.exports = new SiteConfig();

View file

@ -1,7 +0,0 @@
function SlackConfig () {
this.slackWebHook = 'default';
this.slackErrorChannel = 'default';
this.slackInfoChannel = 'default';
};
module.exports = new SlackConfig();

6
devConfig/lbryConfig.js Normal file
View file

@ -0,0 +1,6 @@
module.exports = {
api: {
apiHost: 'localhost',
apiPort: '5279',
},
};

View file

@ -1,8 +1,6 @@
const lbryConfig = { module.exports = {
api: { api: {
apiHost: 'localhost', apiHost: 'localhost',
apiPort: '5279', apiPort: '5279',
}, },
}; };
module.exports = lbryConfig;

View file

@ -0,0 +1,3 @@
module.exports = {
logLevel: 'debug', // options: silly, debug, verbose, info
};

View file

@ -1,5 +1,3 @@
const loggerConfig = { module.exports = {
logLevel: 'debug', // options: silly, debug, verbose, info logLevel: 'debug', // options: silly, debug, verbose, info
}; };
module.exports = loggerConfig;

View file

@ -1,7 +1,5 @@
function SlackConfig () { module.exports = {
this.slackWebHook = null; slackWebHook : null,
this.slackErrorChannel = null; slackErrorChannel: null,
this.slackInfoChannel = null; slackInfoChannel : null,
}; };
module.exports = new SlackConfig();

10911
index.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
"test": "mocha --recursive", "test": "mocha --recursive",
"test-all": "mocha --recursive", "test-all": "mocha --recursive",
"start": "node index.js", "start": "node index.js",
"start-dev": "nodemon server/index.js", "start-dev": "nodemon index.js",
"lint": "eslint .", "lint": "eslint .",
"fix": "eslint . --fix", "fix": "eslint . --fix",
"precommit": "eslint .", "precommit": "eslint .",

View file

@ -1,17 +1,23 @@
// app dependencies // dependencies
const express = require('express'); const express = require('express');
const bodyParser = require('body-parser'); const bodyParser = require('body-parser');
const expressHandlebars = require('express-handlebars'); const expressHandlebars = require('express-handlebars');
const Handlebars = require('handlebars'); const Handlebars = require('handlebars');
const helmet = require('helmet'); const helmet = require('helmet');
const passport = require('passport'); const passport = require('passport');
const { serializeSpeechUser, deserializeSpeechUser } = require('./helpers/authHelpers.js');
const cookieSession = require('cookie-session'); const cookieSession = require('cookie-session');
const http = require('http'); const { serializeSpeechUser, deserializeSpeechUser } = require('./server/helpers/authHelpers.js');
// logging dependencies
const logger = require('winston'); const logger = require('winston');
const {auth: { sessionKey }, details: { port: PORT }} = require('../config/siteConfig.js'); // require configs
const {auth: { sessionKey }, details: { port: PORT }} = require('./config/siteConfig.js');
const db = require('./server/models');
// configure logging
require('./server/helpers/configureLogger.js')(logger);
// configure slack
require('./server/helpers/configureSlack.js')(logger);
// create an Express application // create an Express application
const app = express(); const app = express();
@ -32,8 +38,8 @@ app.use((req, res, next) => { // custom logging middleware to log all incoming
// configure passport // configure passport
passport.serializeUser(serializeSpeechUser); passport.serializeUser(serializeSpeechUser);
passport.deserializeUser(deserializeSpeechUser); passport.deserializeUser(deserializeSpeechUser);
const localSignupStrategy = require('./passport/local-signup.js'); const localSignupStrategy = require('./server/passport/local-signup.js');
const localLoginStrategy = require('./passport/local-login.js'); const localLoginStrategy = require('./server/passport/local-login.js');
passport.use('local-signup', localSignupStrategy); passport.use('local-signup', localSignupStrategy);
passport.use('local-login', localLoginStrategy); passport.use('local-login', localLoginStrategy);
// initialize passport // initialize passport
@ -53,25 +59,22 @@ const hbs = expressHandlebars.create({
app.engine('handlebars', hbs.engine); app.engine('handlebars', hbs.engine);
app.set('view engine', 'handlebars'); app.set('view engine', 'handlebars');
// set the routes on the app
require('./routes/auth-routes.js')(app);
require('./routes/api-routes.js')(app);
require('./routes/page-routes.js')(app);
require('./routes/asset-routes.js')(app);
require('./routes/fallback-routes.js')(app);
// create server
const server = http.Server(app);
// configure logger
require('./helpers/configureLogger.js')(logger);
require('./helpers/configureSlack.js')(logger);
// sync sequelize // sync sequelize
const db = require('./models/index'); db.sequelize
db.sequelize.sync() .sync()
// start the server
.then(() => { .then(() => {
// set the routes on the app
require('./server/routes/auth-routes.js')(app);
require('./server/routes/api-routes.js')(app);
require('./server/routes/page-routes.js')(app);
require('./server/routes/asset-routes.js')(app);
require('./server/routes/fallback-routes.js')(app);
// create server
const http = require('http');
return http.Server(app);
})
// start the server
.then(server => {
server.listen(PORT, () => { server.listen(PORT, () => {
logger.info(`Server is listening on PORT ${PORT}`); logger.info(`Server is listening on PORT ${PORT}`);
}); });

View file

@ -1,4 +1,4 @@
const db = require('../models/index'); const db = require('../models');
const logger = require('winston'); const logger = require('winston');
module.exports = { module.exports = {

View file

@ -1,4 +1,4 @@
const { logLevel } = require('../../config/loggerConfig'); const { logLevel } = require('../../devConfig/loggerConfig');
module.exports = (winston) => { module.exports = (winston) => {
// configure // configure

View file

@ -1,5 +1,5 @@
const winstonSlackWebHook = require('winston-slack-webhook').SlackWebHook; const winstonSlackWebHook = require('winston-slack-webhook').SlackWebHook;
const slackConfig = require('../../config/slackConfig.js'); const slackConfig = require('../../devConfig/slackConfig.js');
module.exports = (winston) => { module.exports = (winston) => {
const {slackWebHook, slackErrorChannel, slackInfoChannel} = slackConfig; const {slackWebHook, slackErrorChannel, slackInfoChannel} = slackConfig;

View file

@ -1,11 +1,11 @@
import React from 'react'; import React from 'react';
import { renderToString } from 'react-dom/server'; import { renderToString } from 'react-dom/server';
import { createStore } from 'redux'; import { createStore } from 'redux';
import Reducer from '../../client/reducers/index'; import Reducer from 'reducers';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { StaticRouter } from 'react-router-dom'; import { StaticRouter } from 'react-router-dom';
import GAListener from '../../client/components/GAListener/index'; import GAListener from 'components/GAListener';
import App from '../../client/app'; import App from 'app.jsx';
import renderFullPage from './renderFullPage.js'; import renderFullPage from './renderFullPage.js';
import Helmet from 'react-helmet'; import Helmet from 'react-helmet';

View file

@ -1,16 +1,16 @@
import React from 'react'; import React from 'react';
import { renderToString } from 'react-dom/server'; import { renderToString } from 'react-dom/server';
import { createStore, applyMiddleware } from 'redux'; import { createStore, applyMiddleware } from 'redux';
import Reducer from '../../client/reducers/index'; import Reducer from 'reducers/index';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { StaticRouter } from 'react-router-dom'; import { StaticRouter } from 'react-router-dom';
import GAListener from '../../client/components/GAListener/index'; import GAListener from 'components/GAListener';
import App from '../../client/app'; import App from 'app.jsx';
import renderFullPage from './renderFullPage'; import renderFullPage from './renderFullPage';
import createSagaMiddleware from 'redux-saga'; import createSagaMiddleware from 'redux-saga';
import { call } from 'redux-saga/effects'; import { call } from 'redux-saga/effects';
import { handleShowPageUri } from '../../client/sagas/show_uri'; import { handleShowPageUri } from 'sagas/show_uri';
import { onHandleShowPageUri } from '../../client/actions/show'; import { onHandleShowPageUri } from 'actions/show';
import Helmet from 'react-helmet'; import Helmet from 'react-helmet';

View file

@ -1,6 +1,6 @@
const axios = require('axios'); const axios = require('axios');
const logger = require('winston'); const logger = require('winston');
const { api: { apiHost, apiPort } } = require('../../config/lbryConfig.js'); const { api: { apiHost, apiPort } } = require('../../devConfig/lbryConfig.js');
const lbryApiUri = 'http://' + apiHost + ':' + apiPort; const lbryApiUri = 'http://' + apiHost + ':' + apiPort;
const { chooseGaLbrynetPublishLabel, sendGATimingEvent } = require('./googleAnalytics.js'); const { chooseGaLbrynetPublishLabel, sendGATimingEvent } = require('./googleAnalytics.js');

View file

@ -1,7 +1,7 @@
const PassportLocalStrategy = require('passport-local').Strategy; const PassportLocalStrategy = require('passport-local').Strategy;
const lbryApi = require('../helpers/lbryApi.js'); const lbryApi = require('../helpers/lbryApi.js');
const logger = require('winston'); const logger = require('winston');
const db = require('../models/index'); const db = require('../models');
module.exports = new PassportLocalStrategy( module.exports = new PassportLocalStrategy(
{ {

View file

@ -2,7 +2,7 @@ const logger = require('winston');
const multipart = require('connect-multiparty'); const multipart = require('connect-multiparty');
const { publishing: { uploadDirectory }, details: { host } } = require('../../config/siteConfig.js'); const { publishing: { uploadDirectory }, details: { host } } = require('../../config/siteConfig.js');
const multipartMiddleware = multipart({uploadDir: uploadDirectory}); const multipartMiddleware = multipart({uploadDir: uploadDirectory});
const db = require('../models/index'); const db = require('../models');
const { claimNameIsAvailable, checkChannelAvailability, publish } = require('../controllers/publishController.js'); const { claimNameIsAvailable, checkChannelAvailability, publish } = require('../controllers/publishController.js');
const { getClaimList, resolveUri, getClaim } = require('../helpers/lbryApi.js'); const { getClaimList, resolveUri, getClaim } = require('../helpers/lbryApi.js');
const { addGetResultsToFileData, createBasicPublishParams, createThumbnailPublishParams, parsePublishApiRequestBody, parsePublishApiRequestFiles, createFileData } = require('../helpers/publishHelpers.js'); const { addGetResultsToFileData, createBasicPublishParams, createThumbnailPublishParams, parsePublishApiRequestBody, parsePublishApiRequestFiles, createFileData } = require('../helpers/publishHelpers.js');

View file

@ -1,6 +1,6 @@
// load dependencies // load dependencies
const logger = require('winston'); const logger = require('winston');
const db = require('../models/index'); // require our models for syncing const db = require('../models'); // require our models for syncing
// configure logging // configure logging
require('../helpers/configureLogger.js')(logger); require('../helpers/configureLogger.js')(logger);

View file

@ -8,10 +8,10 @@ module.exports = {
__dirname: false, __dirname: false,
}, },
externals: [nodeExternals()], externals: [nodeExternals()],
entry : ['babel-polyfill', 'whatwg-fetch', './server/server.js'], entry : ['babel-polyfill', 'whatwg-fetch', './server.js'],
output : { output : {
path : Path.join(__dirname, 'server/'), path : Path.join(__dirname, '/'),
publicPath : 'server/', publicPath : '/',
filename : 'index.js', filename : 'index.js',
library : '', library : '',
libraryTarget: 'commonjs-module', libraryTarget: 'commonjs-module',