Skip to content

Commit

Permalink
Missing semicolons.
Browse files Browse the repository at this point in the history
  • Loading branch information
balajis committed Aug 9, 2013
1 parent 4967188 commit 12aaf19
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
66 changes: 33 additions & 33 deletions models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,48 @@ if (!global.hasOwnProperty('db')) {
var PGPASS_FILE = '../.pgpass';
if (process.env.DATABASE_URL) {
/* Remote database
Do `heroku config` for details. We will be parsing a connection
Do `heroku config` for details. We will be parsing a connection
string of the form:
postgres://bucsqywelrjenr:ffGhjpe9dR13uL7anYjuk3qzXo@\
ec2-54-221-204-17.compute-1.amazonaws.com:5432/d4cftmgjmremg1
*/
var pgregex = /postgres:\/\/([^:]+):([^@]+)@([^:]+):(\d+)\/(.+)/
var match = process.env.DATABASE_URL.match(pgregex);
var user = match[1];
var password = match[2];
var host = match[3];
var port = match[4];
var dbname = match[5];
var config = {
dialect: 'postgres',
protocol: 'postgres',
port: port,
host: host,
logging: true //false
};
sq = new Sequelize(dbname, user, password, config);
*/
var pgregex = /postgres:\/\/([^:]+):([^@]+)@([^:]+):(\d+)\/(.+)/;
var match = process.env.DATABASE_URL.match(pgregex);
var user = match[1];
var password = match[2];
var host = match[3];
var port = match[4];
var dbname = match[5];
var config = {
dialect: 'postgres',
protocol: 'postgres',
port: port,
host: host,
logging: true //false
};
sq = new Sequelize(dbname, user, password, config);
} else {
/* Local database
We parse the .pgpass file for the connection string parameters.
*/
var pgtokens = fs.readFileSync(PGPASS_FILE).toString().split(':');
var host = pgtokens[0];
var port = pgtokens[1];
var dbname = pgtokens[2];
var user = pgtokens[3];
var password = pgtokens[4];
var config = {
dialect: 'postgres',
protocol: 'postgres',
port: port,
host: host,
};
var sq = new Sequelize(dbname, user, password, config);
var pgtokens = fs.readFileSync(PGPASS_FILE).toString().split(':');
var host = pgtokens[0];
var port = pgtokens[1];
var dbname = pgtokens[2];
var user = pgtokens[3];
var password = pgtokens[4];
var config = {
dialect: 'postgres',
protocol: 'postgres',
port: port,
host: host,
};
var sq = new Sequelize(dbname, user, password, config);
}
global.db = {
Sequelize: Sequelize,
sequelize: sq,
Order: sq.import(__dirname + '/order')
Sequelize: Sequelize,
sequelize: sq,
Order: sq.import(__dirname + '/order')
};
}
module.exports = global.db;
4 changes: 2 additions & 2 deletions models/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ module.exports = function(sequelize, DataTypes) {
coinbase_id: {type: DataTypes.STRING, unique: true, allowNull: false},
amount: {type: DataTypes.FLOAT},
time: {type: DataTypes.STRING, allowNull: false}
})
}
});
};

0 comments on commit 12aaf19

Please sign in to comment.