Speech as a package #416
8 changed files with 383 additions and 219 deletions
|
@ -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');
|
||||||
|
|
|
@ -6,6 +6,7 @@ function mysql () {
|
||||||
This should probably be 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...');
|
||||||
This should probably be 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;
|
||||||
|
|
||||||
This should probably be This should probably be `new Mysql()` since it is a class function
This should probably be This should probably be `new Mysql()` since it is a class function
|
|
@ -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
583
index.js
File diff suppressed because one or more lines are too long
1
index.js.map
Normal file
1
index.js.map
Normal file
File diff suppressed because one or more lines are too long
|
@ -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
|
||||||
|
|
|
@ -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) => {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue
This should probably be
new Mysql()
since it is a class function