Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Commit

Permalink
Error handling - Catch properly the error when DATABASE_URL does not …
Browse files Browse the repository at this point in the history
…exist.
  • Loading branch information
SeyZ committed Oct 11, 2018
1 parent 666cd40 commit 903edcb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Change Log

## [Unreleased]
### Changed
- Error handling - Catch properly the error when DATABASE_URL does not exist.

## Release 1.11.1
### Changed
Expand Down
5 changes: 5 additions & 0 deletions templates/app/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ const fs = require('fs');
const path = require('path');
const Sequelize = require('sequelize');

if (!process.env.DATABASE_URL) {
console.error('Cannot connect to the database. Please declare the DATABASE_URL environment variable with the correct database connection string.');
process.exit();
}

let databaseOptions = {
logging: process.env.NODE_ENV === 'development' ? console.log : false,
pool: { maxConnections: 10, minConnections: 1 },
Expand Down

0 comments on commit 903edcb

Please sign in to comment.