mirror of
https://github.com/wassname/HackFlowy.git
synced 2026-09-09 11:14:22 +08:00
Heroku integration with foreman
Add foreman configuration for Heroku: - To test production configuration execute NODE_ENV=production foreman start - Database connection configuration now handles "use_env_variable" which should be defined as a environment variable such as "DATABASE_URL" with a proper database URI connection string, ie: postgres://user:password@db.example.com:5432/database - Added package.json configuration to run migrations and db seed after `npm install` Update frontend models to match sequelize definition. Update views to work according to the changes above. Handling isCompleted and parentId apropiately for PostgreSQL databases
This commit is contained in:
@@ -1,7 +1,26 @@
|
||||
var Sequelize = require('sequelize');
|
||||
|
||||
/* http://sequelizejs.com/articles/heroku */
|
||||
var parseUrl = function(url) {
|
||||
var match = url.match(/([\w]+):\/\/([^:]+):([^@]+)@([^:]+):(\d+)\/(.+)/);
|
||||
db = {
|
||||
database : match[6],
|
||||
username : match[2],
|
||||
password : match[3],
|
||||
options : {
|
||||
port : match[5],
|
||||
host : match[4],
|
||||
dialect : match[1],
|
||||
}
|
||||
}
|
||||
return db;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
configure: function(db) {
|
||||
db.url = db.use_env_variable ? process.env[db.use_env_variable] : null;
|
||||
db = db.url ? parseUrl(db.url) : db;
|
||||
return new Sequelize(db.database, db.username, db.password, db.options);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user