changed publishing to claim and updated config imports

This commit is contained in:
bill bittner 2017-12-16 09:55:29 -08:00
parent d281e0fb72
commit 13d29a42b4
4 changed files with 13 additions and 14 deletions

View file

@ -1,25 +1,26 @@
const config = require('./speechConfig.js');
const { logging } = require('./speechConfig.js');
const { slackWebHook, slackErrorChannel, slackInfoChannel } = logging;
const winstonSlackWebHook = require('winston-slack-webhook').SlackWebHook;
module.exports = (winston) => {
if (config.logging.slackWebHook) {
if (slackWebHook) {
// add a transport for errors to slack
if (config.logging.slackErrorChannel) {
if (slackErrorChannel) {
winston.add(winstonSlackWebHook, {
name : 'slack-errors-transport',
level : 'warn',
webhookUrl: config.logging.slackWebHook,
channel : config.logging.slackErrorChannel,
webhookUrl: slackWebHook,
channel : slackErrorChannel,
username : 'spee.ch',
iconEmoji : ':face_with_head_bandage:',
});
};
if (config.logging.slackInfoChannel) {
if (slackInfoChannel) {
winston.add(winstonSlackWebHook, {
name : 'slack-info-transport',
level : 'info',
webhookUrl: config.logging.slackWebHook,
channel : config.logging.slackInfoChannel,
webhookUrl: slackWebHook,
channel : slackInfoChannel,
username : 'spee.ch',
iconEmoji : ':nerd_face:',
});

View file

@ -1,7 +1,7 @@
const logger = require('winston');
const { returnShortId } = require('../helpers/sequelizeHelpers.js');
const { publishing, site } = require('../config/speechConfig.js');
const { defaultTitle, defaultThumbnail, defaultDescription } = publishing;
const { claim, site } = require('../config/speechConfig.js');
const { defaultTitle, defaultThumbnail, defaultDescription } = claim;
const { host } = site;
function determineFileExtensionFromContentType (contentType) {

View file

@ -4,9 +4,7 @@ const Sequelize = require('sequelize');
const basename = path.basename(module.filename);
const logger = require('winston');
const config = require('../config/speechConfig.js');
const database = config.sql.database;
const username = config.sql.username;
const password = config.sql.password;
const { database, username, password } = config.sql;
const db = {};
// set sequelize options

View file

@ -3,7 +3,7 @@ const logger = require('winston');
const db = require('../models/index'); // require our models for syncing
// configure logging
const config = require('../config/speechConfig.js');
const logLevel = config.logging.logLevel;
const { logLevel } = config.logging;
require('../config/loggerConfig.js')(logger, logLevel);
const userName = process.argv[2];