changed publishing to claim and updated config imports #308

Merged
bones7242 merged 1 commit from 305-config-publishing into master 2017-12-18 22:13:29 +01:00
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; const winstonSlackWebHook = require('winston-slack-webhook').SlackWebHook;
module.exports = (winston) => { module.exports = (winston) => {
if (config.logging.slackWebHook) { if (slackWebHook) {
// add a transport for errors to slack // add a transport for errors to slack
if (config.logging.slackErrorChannel) { if (slackErrorChannel) {
winston.add(winstonSlackWebHook, { winston.add(winstonSlackWebHook, {
name : 'slack-errors-transport', name : 'slack-errors-transport',
level : 'warn', level : 'warn',
webhookUrl: config.logging.slackWebHook, webhookUrl: slackWebHook,
channel : config.logging.slackErrorChannel, channel : slackErrorChannel,
username : 'spee.ch', username : 'spee.ch',
iconEmoji : ':face_with_head_bandage:', iconEmoji : ':face_with_head_bandage:',
}); });
}; };
if (config.logging.slackInfoChannel) { if (slackInfoChannel) {
winston.add(winstonSlackWebHook, { winston.add(winstonSlackWebHook, {
name : 'slack-info-transport', name : 'slack-info-transport',
level : 'info', level : 'info',
webhookUrl: config.logging.slackWebHook, webhookUrl: slackWebHook,
channel : config.logging.slackInfoChannel, channel : slackInfoChannel,
username : 'spee.ch', username : 'spee.ch',
iconEmoji : ':nerd_face:', iconEmoji : ':nerd_face:',
}); });

View file

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

View file

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

View file

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