Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Add envvars for deploying to cloud providers
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelcoba committed Apr 8, 2014
1 parent f150407 commit fa1171f
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 50 deletions.
10 changes: 7 additions & 3 deletions config/env/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
var path = require('path'),
rootPath = path.normalize(__dirname + '/../..');

var port = process.env.PORT || 3000;
var appUrl = process.env.APP_URL || ('http://localhost:' + port);

module.exports = {
app: {
title: 'MEAN.JS',
description: 'Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js',
keywords: 'mongodb, express, angularjs, node.js, mongoose, passport'
},
root: rootPath,
port: process.env.PORT || 3000,
port: port,
appUrl: appUrl,
templateEngine: 'swig',
sessionSecret: 'MEAN',
sessionSecret: process.env.SESSION_SECRET || 'MEAN',
sessionCollection: 'sessions'
};
};
26 changes: 13 additions & 13 deletions config/env/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ module.exports = {
title: 'MEAN.JS - Development Environment'
},
facebook: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/facebook/callback'
clientID: process.env.FACEBOOK_ID || 'APP_ID',
clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET',
callbackPath: '/auth/facebook/callback'
},
twitter: {
clientID: 'CONSUMER_KEY',
clientSecret: 'CONSUMER_SECRET',
callbackURL: 'http://localhost:3000/auth/twitter/callback'
clientID: process.env.TWITTER_KEY || 'CONSUMER_KEY',
clientSecret: process.env.TWITTER_SECRET || 'CONSUMER_SECRET',
callbackPath: '/auth/twitter/callback'
},
google: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/google/callback'
clientID: process.env.GOOGLE_ID || 'APP_ID',
clientSecret: process.env.GOOGLE_SECRET || 'APP_SECRET',
callbackPath: '/auth/google/callback'
},
linkedin: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
clientID: process.env.LINKEDIN_ID || 'APP_ID',
clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET',
callbackPath: '/auth/linkedin/callback'
}
};
};
26 changes: 13 additions & 13 deletions config/env/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
module.exports = {
db: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://localhost/mean',
facebook: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/facebook/callback'
clientID: process.env.FACEBOOK_ID || 'APP_ID',
clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET',
callbackPath: '/auth/facebook/callback'
},
twitter: {
clientID: 'CONSUMER_KEY',
clientSecret: 'CONSUMER_SECRET',
callbackURL: 'http://localhost:3000/auth/twitter/callback'
clientID: process.env.TWITTER_KEY || 'CONSUMER_KEY',
clientSecret: process.env.TWITTER_SECRET || 'CONSUMER_SECRET',
callbackPath: '/auth/twitter/callback'
},
google: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/google/callback'
clientID: process.env.GOOGLE_ID || 'APP_ID',
clientSecret: process.env.GOOGLE_SECRET || 'APP_SECRET',
callbackPath: '/auth/google/callback'
},
linkedin: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
clientID: process.env.LINKEDIN_ID || 'APP_ID',
clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET',
callbackPath: '/auth/linkedin/callback'
}
};
};
26 changes: 13 additions & 13 deletions config/env/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ module.exports = {
title: 'MEAN.JS - Test Environment'
},
facebook: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/facebook/callback'
clientID: process.env.FACEBOOK_ID || 'APP_ID',
clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET',
callbackPath: '/auth/facebook/callback'
},
twitter: {
clientID: 'CONSUMER_KEY',
clientSecret: 'CONSUMER_SECRET',
callbackURL: 'http://localhost:3000/auth/twitter/callback'
clientID: process.env.TWITTER_KEY || 'CONSUMER_KEY',
clientSecret: process.env.TWITTER_SECRET || 'CONSUMER_SECRET',
callbackPath: '/auth/twitter/callback'
},
google: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/google/callback'
clientID: process.env.GOOGLE_ID || 'APP_ID',
clientSecret: process.env.GOOGLE_SECRET || 'APP_SECRET',
callbackPath: '/auth/google/callback'
},
linkedin: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
clientID: process.env.LINKEDIN_ID || 'APP_ID',
clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET',
callbackPath: '/auth/linkedin/callback'
}
};
};
5 changes: 3 additions & 2 deletions config/strategies/facebook.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

var passport = require('passport'),
url = require('url'),
FacebookStrategy = require('passport-facebook').Strategy,
User = require('mongoose').model('User'),
config = require('../config');
Expand All @@ -10,7 +11,7 @@ module.exports = function() {
passport.use(new FacebookStrategy({
clientID: config.facebook.clientID,
clientSecret: config.facebook.clientSecret,
callbackURL: config.facebook.callbackURL,
callbackURL: url.resolve(config.appUrl, config.facebook.callbackPath),
passReqToCallback: true
},
function(req, accessToken, refreshToken, profile, done) {
Expand Down Expand Up @@ -46,4 +47,4 @@ module.exports = function() {
}
}
));
};
};
5 changes: 3 additions & 2 deletions config/strategies/google.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

var passport = require('passport'),
url = require('url'),
GoogleStrategy = require('passport-google-oauth').OAuth2Strategy,
User = require('mongoose').model('User'),
config = require('../config');
Expand All @@ -10,7 +11,7 @@ module.exports = function() {
passport.use(new GoogleStrategy({
clientID: config.google.clientID,
clientSecret: config.google.clientSecret,
callbackURL: config.google.callbackURL,
callbackURL: url.resolve(config.appUrl, config.google.callbackPath),
passReqToCallback: true
},
function(req, accessToken, refreshToken, profile, done) {
Expand Down Expand Up @@ -45,4 +46,4 @@ module.exports = function() {
}
}
));
};
};
5 changes: 3 additions & 2 deletions config/strategies/linkedin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

var passport = require('passport'),
url = require('url'),
LinkedInStrategy = require('passport-linkedin').Strategy,
User = require('mongoose').model('User'),
config = require('../config');
Expand All @@ -10,7 +11,7 @@ module.exports = function() {
passport.use(new LinkedInStrategy({
consumerKey: config.linkedin.clientID,
consumerSecret: config.linkedin.clientSecret,
callbackURL: config.linkedin.callbackURL,
callbackURL: url.resolve(config.appUrl, config.linkedin.callbackPath),
passReqToCallback: true,
profileFields: ['id', 'first-name', 'last-name', 'email-address']
},
Expand Down Expand Up @@ -46,4 +47,4 @@ module.exports = function() {
}
}
));
};
};
5 changes: 3 additions & 2 deletions config/strategies/twitter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

var passport = require('passport'),
url = require('url'),
TwitterStrategy = require('passport-twitter').Strategy,
User = require('mongoose').model('User'),
config = require('../config');
Expand All @@ -10,7 +11,7 @@ module.exports = function() {
passport.use(new TwitterStrategy({
consumerKey: config.twitter.clientID,
consumerSecret: config.twitter.clientSecret,
callbackURL: config.twitter.callbackURL,
callbackURL: url.resolve(config.appUrl, config.twitter.callbackPath),
passReqToCallback: true
},
function(req, token, tokenSecret, profile, done) {
Expand Down Expand Up @@ -43,4 +44,4 @@ module.exports = function() {
}
}
));
};
};

0 comments on commit fa1171f

Please sign in to comment.