Skip to content

@alduro /gist:4605672
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Sequelize Locomotive initializer.
module.exports = function() {
console.log('ENVIRONMENT');
console.log(this.env);
switch(this.env) {
case 'development':
var sequelize = new Sequelize('paragon_development', 'root', null);
break;
case 'production':
if (process.env['HEROKU_POSTGRESQL_COPPER_URL']) {
var url = require('url').parse(process.env['HEROKU_POSTGRESQL_COPPER_URL']);
console.log(url);
var pgOpts = {
pathname: url.pathname,
port: url.port,
host: url.hostname,
user: url.auth.split(':')[0],
pass: url.auth.split(':')[1]
};
var sequelize = new Sequelize(pgOpts.pathname, pgOpts.user , pgOpts.pass, {
host: pgOpts.hostname,
port: pgOpts.port,
dialect: 'postgres',
// custom protocol
// - default: 'tcp'
// - added in: v1.5.0
// - postgres only, useful for heroku
protocol: null
});
}
break;
}
@alduro
Owner

Heroku var:
HEROKU_POSTGRESQL_JADE_URL: postgres://sgcggjfwldxmvj:PeLXfyFqOBomqjny8bGRcMiNGn@ec2-54-243-181-115.compute-1.amazonaws.com:5432/ddr742teg2dnho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.