diff --git a/after/routes/index.js b/after/routes/index.js index ca2b2ba..f578b6d 100644 --- a/after/routes/index.js +++ b/after/routes/index.js @@ -1,7 +1,15 @@ require('dotenv').config(); const extendContainer = process.env.EXTEND_CONTAINER; -const extendURL = `https://${extendContainer}.sandbox.auth0-extend.com/`; + +let extendHost = 'https://sandbox.auth0-extend.com'; +let extendURL = `https://${extendContainer}.sandbox.auth0-extend.com/`; + +if(process.env.EXTEND_HOST) { + extendHost = process.env.EXTEND_HOST; + extendURL = extendHost.replace('https://', `https://${extendContainer}.`)+'/'; +} + const extendToken = process.env.EXTEND_TOKEN; const request = require('request'); @@ -17,7 +25,8 @@ module.exports = function(app) { res.render('settings', { nav:'settings', container:extendContainer, - token:extendToken + token:extendToken, + host:extendHost }); }); @@ -26,7 +35,6 @@ module.exports = function(app) { // this is where - normally - a process of somesort would persist the value // data.created is simply demonstrating a server-side change data.created = new Date(); - let options = { method:'POST', url:extendURL +'saveLead', @@ -35,6 +43,7 @@ module.exports = function(app) { }; request(options, (error, response, body) => { + console.log(body); if(error) throw new Error(error); res.json(body); }); diff --git a/after/views/settings.handlebars b/after/views/settings.handlebars index 47fee7b..cec6bd3 100644 --- a/after/views/settings.handlebars +++ b/after/views/settings.handlebars @@ -4,7 +4,7 @@