diff --git a/app.js b/app.js index 7a74838..5428dc5 100644 --- a/app.js +++ b/app.js @@ -6,7 +6,7 @@ var hbs = require('hbs'); var app = express(); app.set('view engine', 'hbs'); -app.set('trust proxy', 'loopback'); +app.enable('trust proxy'); function isSetup() { return (process.env.CONSUMER_KEY != null) && (process.env.CONSUMER_SECRET != null); @@ -66,8 +66,12 @@ app.get('/setup', function(req, res) { res.redirect('/'); } else { - var isRemote = (req.hostname.indexOf('localhost') != 0); - res.render('setup', { isRemote: isRemote, oauthCallbackUrl: oauthCallbackUrl(req) }); + var isLocal = (req.hostname.indexOf('localhost') == 0); + var herokuApp = null; + if (req.hostname.indexOf('.herokuapp.com') > 0) { + herokuApp = req.hostname.replace(".herokuapp.com", ""); + } + res.render('setup', { isLocal: isLocal, oauthCallbackUrl: oauthCallbackUrl(req), herokuApp: herokuApp}); } }); diff --git a/views/setup.hbs b/views/setup.hbs index 8d99e84..b54bbcc 100644 --- a/views/setup.hbs +++ b/views/setup.hbs @@ -2,7 +2,7 @@
CONSUMER_KEY
with the value of your Connected App's Consumer KeyCONSUMER_SECRET
with the value of your Connected App's Consumer Secret.env
file in the root of your project directory containing the following with your newly created Consumer Key and Consumer Secret values:
# DO NOT SHARE THIS FILE OR PUT IT INTO YOUR SCM
CONSUMER_KEY=YOUR_CONSUMER_KEY