updated mysql config file

This commit is contained in:
bill bittner 2018-03-29 12:33:52 -07:00
parent 6e46e3271d
commit 3e67c784a0
6 changed files with 3426 additions and 3407 deletions

View file

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

View file

@ -1,12 +1,19 @@
const logger = require('winston');
function mysql () {
this.db = {};
this.configure = (db) => {
if (!db) {
return console.log('No MySQL config received.');
this.database = 'default';
this.username = 'default';
this.password = 'default';
this.configure = (config) => {
if (!config) {
return logger.warn('No MySQL config received.');
}
// configure credentials
console.log('configuring mysql...');
this.db = db;
logger.info('configuring mysql...');
const { database, username, password } = config;
this.database = database;
this.username = username;
this.password = password;
};
};

View file

@ -1,3 +1,5 @@
const logger = require('winston');
function SiteConfig () {
this.analytics = {
googleId: 'default',
@ -33,9 +35,10 @@ function SiteConfig () {
};
this.configure = (config) => {
if (!config) {
return console.log('No site config received.');
return logger.warn('No site config received.');
}
const { analytics, assetDefaults, auth, customComponents, details, publishing } = config;
logger.info('Configuring site details...');
this.analytics = analytics;
this.assetDefaults = assetDefaults;
this.auth = auth;

View file

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

6789
index.js

File diff suppressed because one or more lines are too long

View file

@ -25,13 +25,13 @@ function Server () {
require('slackConfig.js').configure(slackConfig);
};
this.configureClientBundle = () => {
console.log('configure the client here by passing in the bundle and configuring it, or better yet: taking in the components to use dynamically from here.');
logger.info('configure the client here by passing in the bundle and configuring it, or better yet: taking in the components to use dynamically from here.');
}
this.configureModels = () => {
console.log('here is where you could add/overwrite the default models')
logger.info('here is where you could add/overwrite the default models')
}
this.configureRoutes = () => {
console.log('here is where you could add/overwrite the default routes')
logger.info('here is where you could add/overwrite the default routes')
}
this.createApp = () => {
// create an Express application
@ -79,8 +79,6 @@ function Server () {
this.app = app;
};
this.initialize = () => {
// require('./helpers/configureLogger.js')(logger);
// require('./helpers/configureSlack.js')(logger);
this.createApp();
this.server = http.Server(this.app);
};