Speech as a package #416

Merged
bones7242 merged 89 commits from speech-as-a-package into master 2018-04-18 21:47:34 +02:00
8 changed files with 383 additions and 219 deletions
Showing only changes of commit 955a2f5e14 - Show all commits

View file

@ -6,6 +6,7 @@ function LoggerConfig () {
if (!config) { if (!config) {
return console.log('No logger config received.'); return console.log('No logger config received.');
} }
console.log('configuring winston logger...');
// update values with local config params // update values with local config params
const {logLevel} = config; const {logLevel} = config;
this.logLevel = logLevel; this.logLevel = logLevel;
@ -23,6 +24,7 @@ function LoggerConfig () {
], ],
}); });
// test all the log levels // test all the log levels
console.log('testing winston log levels...');
logger.error('Level 0'); logger.error('Level 0');
logger.warn('Level 1'); logger.warn('Level 1');
logger.info('Level 2'); logger.info('Level 2');

View file

@ -6,6 +6,7 @@ function mysql () {
neb-b commented 2018-04-17 22:32:37 +02:00 (Migrated from github.com)
Review

This should probably be new Mysql() since it is a class function

This should probably be `new Mysql()` since it is a class function
neb-b commented 2018-04-17 22:32:37 +02:00 (Migrated from github.com)
Review

This should probably be new Mysql() since it is a class function

This should probably be `new Mysql()` since it is a class function
if (!config) { if (!config) {
return console.log('No MySQL config received.'); return console.log('No MySQL config received.');
} }
console.log('configuring mysql credentials...');
neb-b commented 2018-04-17 22:32:37 +02:00 (Migrated from github.com)
Review

This should probably be new Mysql() since it is a class function

This should probably be `new Mysql()` since it is a class function
const {database, username, password} = config; const {database, username, password} = config;
this.database = database; this.database = database;
this.username = username; this.username = username;

neb-b commented 2018-04-17 22:32:37 +02:00 (Migrated from github.com)
Review

This should probably be new Mysql() since it is a class function

This should probably be `new Mysql()` since it is a class function
neb-b commented 2018-04-17 22:32:37 +02:00 (Migrated from github.com)
Review

This should probably be new Mysql() since it is a class function

This should probably be `new Mysql()` since it is a class function

View file

@ -7,9 +7,10 @@ function SlackConfig () {
this.slackInfoChannel = 'default'; this.slackInfoChannel = 'default';
this.configure = (config) => { this.configure = (config) => {
if (!config) { if (!config) {
return console.log('No slack config received.'); return console.log('no slack config received');
} }
// update variables // update variables
console.log('configuring slack logger...');
const {slackWebHook, slackErrorChannel, slackInfoChannel} = config; const {slackWebHook, slackErrorChannel, slackInfoChannel} = config;
this.slackWebHook = slackWebHook; this.slackWebHook = slackWebHook;
this.slackErrorChannel = slackErrorChannel; this.slackErrorChannel = slackErrorChannel;
@ -38,6 +39,7 @@ function SlackConfig () {
}); });
}; };
// send test messages // send test messages
console.log('testing slack logger...');
winston.error('Slack "error" logging is online.'); winston.error('Slack "error" logging is online.');
winston.info('Slack "info" logging is online.'); winston.info('Slack "info" logging is online.');
} else { } else {

583
index.js

File diff suppressed because one or more lines are too long

1
index.js.map Normal file

File diff suppressed because one or more lines are too long

View file

@ -2,7 +2,8 @@ const Sequelize = require('sequelize');
const logger = require('winston'); const logger = require('winston');
logger.info('exporting sequelize models'); logger.info('exporting sequelize models');
const { database, username, password } = require('../../config/mysqlConfig'); const mysqlConfig = require('../../config/mysqlConfig');
const { database, username, password } = mysqlConfig;
const db = {}; const db = {};
// set sequelize options // set sequelize options

View file

@ -1,6 +1,6 @@
const PassportLocalStrategy = require('passport-local').Strategy; const PassportLocalStrategy = require('passport-local').Strategy;
const logger = require('winston'); const logger = require('winston');
const db = require('../models/index'); const db = require('../models');
const returnUserAndChannelInfo = (userInstance) => { const returnUserAndChannelInfo = (userInstance) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View file

@ -7,6 +7,8 @@ const logger = require('./config/loggerConfig.js');
const mysql = require('./config/mysqlConfig.js'); const mysql = require('./config/mysqlConfig.js');
const slack = require('./config/slackConfig.js'); const slack = require('./config/slackConfig.js');
const database = require('./server/models'); const database = require('./server/models');
const localLoginStrategy = require('./server/passport/local-login.js');
const localSignupStrategy = require('./server/passport/local-signup.js');
const exports = { const exports = {
// Server, // Server,
@ -20,6 +22,10 @@ const exports = {
slack, slack,
}, },
database, database,
passport: {
localLoginStrategy,
localSignupStrategy,
},
}; };
module.exports = exports; module.exports = exports;