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/mysqlConfig.js
config/siteConfig.js
config/slackConfig.js
devConfig/slackConfig.js
devConfig/sequelizeCliConfig.js
devConfig/testingConfig.js
public/bundle/
index.js

View file

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

View file

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

View file

@ -1,7 +1,5 @@
function SlackConfig () {
this.slackWebHook = null;
this.slackErrorChannel = null;
this.slackInfoChannel = null;
module.exports = {
slackWebHook : null,
slackErrorChannel: 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-all": "mocha --recursive",
"start": "node index.js",
"start-dev": "nodemon server/index.js",
"start-dev": "nodemon index.js",
"lint": "eslint .",
"fix": "eslint . --fix",
"precommit": "eslint .",

View file

@ -1,17 +1,23 @@
// app dependencies
// dependencies
const express = require('express');
const bodyParser = require('body-parser');
const expressHandlebars = require('express-handlebars');
const Handlebars = require('handlebars');
const helmet = require('helmet');
const passport = require('passport');
const { serializeSpeechUser, deserializeSpeechUser } = require('./helpers/authHelpers.js');
const cookieSession = require('cookie-session');
const http = require('http');
// logging dependencies
const { serializeSpeechUser, deserializeSpeechUser } = require('./server/helpers/authHelpers.js');
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
const app = express();
@ -32,8 +38,8 @@ app.use((req, res, next) => { // custom logging middleware to log all incoming
// configure passport
passport.serializeUser(serializeSpeechUser);
passport.deserializeUser(deserializeSpeechUser);
const localSignupStrategy = require('./passport/local-signup.js');
const localLoginStrategy = require('./passport/local-login.js');
const localSignupStrategy = require('./server/passport/local-signup.js');
const localLoginStrategy = require('./server/passport/local-login.js');
passport.use('local-signup', localSignupStrategy);
passport.use('local-login', localLoginStrategy);
// initialize passport
@ -53,25 +59,22 @@ const hbs = expressHandlebars.create({
app.engine('handlebars', hbs.engine);
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
const db = require('./models/index');
db.sequelize.sync()
// start the server
db.sequelize
.sync()
.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, () => {
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');
module.exports = {

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
const axios = require('axios');
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 { chooseGaLbrynetPublishLabel, sendGATimingEvent } = require('./googleAnalytics.js');

View file

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

View file

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

View file

@ -1,6 +1,6 @@
// load dependencies
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
require('../helpers/configureLogger.js')(logger);

View file

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