var Sequelize = require("sequelize"), config = require("../config.json"), pg = require('pg'); var db = module.exports = {} var DATABASE_URL = process.env.DATABASE_URL || ('postgres://postgres:postgres@localhost:5432/' + config.name) var match = DATABASE_URL.match(/postgres:\/\/([^:]+):([^@]+)@([^:]+):(\d+)\/(.+)/) db.sequelize = new Sequelize(match[5], match[1], match[2], { dialect: 'postgres', protocol: 'postgres', port: match[4], host: match[3], logging: true //false })