Merge pull request #137 from toanalien/fixbug
Update config variables for Heroku
This commit is contained in:
commit
01d94ebffc
|
@ -85,17 +85,17 @@ Create this directory or you will get errors.
|
|||
mkdir uploads/pdfs
|
||||
```
|
||||
|
||||
Edit the 'env' config in gruntfile.js to make sure your .env file is being used. If you don't include this your app won't run
|
||||
Edit the `env` config in gruntfile.js to make sure your .env file is being used. If you don't include this your app won't run
|
||||
|
||||
To run development version:
|
||||
|
||||
Set ```NODE_ENV=development``` in .env file
|
||||
```$ grunt````
|
||||
```$ grunt```
|
||||
|
||||
To run production version:
|
||||
|
||||
Set ```NODE_ENV=development``` in .env file
|
||||
```$ grunt````
|
||||
Set ```NODE_ENV=production``` in .env file
|
||||
```$ grunt```
|
||||
|
||||
Your application should run on port 3000 or the port you specified in your .env file, so in your browser just go to [http://localhost:3000](http://localhost:3000)
|
||||
|
||||
|
|
8
config/env/production.js
vendored
8
config/env/production.js
vendored
|
@ -3,13 +3,9 @@
|
|||
module.exports = {
|
||||
baseUrl: process.env.BASE_URL || 'tellform.com',
|
||||
db: {
|
||||
uri: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/mean',
|
||||
options: {
|
||||
user: '',
|
||||
pass: process.env.MONGOLAB_PASS || ''
|
||||
}
|
||||
uri: process.env.MONGODB_URI
|
||||
},
|
||||
port: process.env.PORT || 4545,
|
||||
port: process.env.PORT || 5000,
|
||||
log: {
|
||||
// Can specify one of 'combined', 'common', 'dev', 'short', 'tiny'
|
||||
format: 'combined',
|
||||
|
|
|
@ -12,7 +12,7 @@ module.exports = function (app, db) {
|
|||
|
||||
var io = socketio(config.socketPort, { transports: ['websocket', 'polling'] });
|
||||
var redis = require('socket.io-redis');
|
||||
io.adapter(redis(process.env.REDIS_HOST || { host: '127.0.0.1', port: 6379 }));
|
||||
io.adapter(redis(process.env.REDIS_URL || { host: '127.0.0.1', port: 6379 }));
|
||||
|
||||
// Add an event listener to the 'connection' event
|
||||
io.on('connection', function (socket) {
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
*/
|
||||
|
||||
//Load ENV vars from .env
|
||||
require('dotenv').config();
|
||||
if ((process.env.NODE_ENV || 'development') === 'development') {
|
||||
require('dotenv').config();
|
||||
}
|
||||
|
||||
var init = require('./config/init')(),
|
||||
config = require('./config/config'),
|
||||
|
@ -18,13 +20,13 @@ var init = require('./config/init')(),
|
|||
*/
|
||||
|
||||
// Bootstrap db connection
|
||||
var db = mongoose.connect(config.db.uri, config.db.options, function(err) {
|
||||
var db = mongoose.connect(config.db.uri, config.db.options, function (err) {
|
||||
if (err) {
|
||||
console.error(chalk.red('Could not connect to MongoDB!'));
|
||||
console.log(chalk.red(err));
|
||||
}
|
||||
});
|
||||
mongoose.connection.on('error', function(err) {
|
||||
mongoose.connection.on('error', function (err) {
|
||||
console.error(chalk.red('MongoDB connection error: ' + err));
|
||||
process.exit(-1);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue