updated today db to cloudant
This commit is contained in:
parent
c253462bc7
commit
bf34b58f41
33
lib/today.js
33
lib/today.js
@ -5,7 +5,7 @@ var http = require('http'), request = require('request'), cheerio = require(
|
||||
'cheerio'), util = require('util'), cron = require('node-cron');
|
||||
var dateFormat = require('dateformat');
|
||||
var jsonfile = require('jsonfile'), fs = require('fs');
|
||||
var nano = require('nano')('http://martind2000:1V3D4m526i@localhost:5984');
|
||||
//var nano = require('nano')('http://martind2000:1V3D4m526i@localhost:5984');
|
||||
var log4js = require('log4js');
|
||||
var logger = log4js.getLogger();
|
||||
var calHandler = require('./today/calHandler');
|
||||
@ -17,8 +17,33 @@ var mdMailer = require('./today/mailer');
|
||||
var mdFitbit = require('./today/fitbit');
|
||||
var todayFTSE = require('./today/todayftse');
|
||||
var quotes = require('./today/quotes');
|
||||
var db_name = 'silvrgit';
|
||||
var dbCouch = nano.use(db_name);
|
||||
//var db_name = 'silvrgit';
|
||||
//var dbCloudant = nano.use(db_name);
|
||||
|
||||
/*
|
||||
|
||||
We've moved to cloudant through IBM Bluemix for the database
|
||||
|
||||
https://25f854ee-1b51-49ff-acd9-5b0ff478d944-bluemix.cloudant.com/dashboard.html#usage
|
||||
|
||||
|
||||
*/
|
||||
|
||||
var credentials = {
|
||||
"username": "25f854ee-1b51-49ff-acd9-5b0ff478d944-bluemix",
|
||||
"password": "8e417af1b0462ca55726848846cc6b8696fc76defe9d1864cbc334be59549e0c",
|
||||
"host": "25f854ee-1b51-49ff-acd9-5b0ff478d944-bluemix.cloudant.com",
|
||||
"port": 443,
|
||||
"url": "https://25f854ee-1b51-49ff-acd9-5b0ff478d944-bluemix:8e417af1b0462ca55726848846cc6b8696fc76defe9d1864cbc334be59549e0c@25f854ee-1b51-49ff-acd9-5b0ff478d944-bluemix.cloudant.com",
|
||||
"database" : "keeper"
|
||||
};
|
||||
|
||||
var Cloudant = require('cloudant');
|
||||
var cloudant = Cloudant({account:credentials.username, password:credentials.password});
|
||||
|
||||
var dbCloudant = cloudant.db.use(credentials.database);
|
||||
|
||||
|
||||
|
||||
require('sugar-date');
|
||||
|
||||
@ -108,7 +133,7 @@ function saveToDB(data) {
|
||||
|
||||
logger.debug('Inserting into couch...');
|
||||
// Logger.info(util.inspect(obj));
|
||||
dbCouch.insert(data, function(err, body, header) {
|
||||
dbCloudant.insert(data, function(err, body, header) {
|
||||
if (err) {
|
||||
logger.error('Error inserting into couch');
|
||||
logger.error(err);
|
||||
|
Loading…
Reference in New Issue
Block a user