From d4814eda34f8064fb1d15c138286bc52e00eb66c Mon Sep 17 00:00:00 2001 From: Lloyd Hilaiel Date: Wed, 26 Oct 2011 09:22:07 -0600 Subject: [PATCH] fix double substitution in local environment introduced in commit f5be9659a944fc4299edbe72b46720fda3e8ac78 - closes #486 --- libs/configuration.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/configuration.js b/libs/configuration.js index 95b11e3a5..54a242378 100644 --- a/libs/configuration.js +++ b/libs/configuration.js @@ -154,13 +154,13 @@ g_config['URL'] = g_config['scheme'] + '://' + g_config['hostname'] + getPortFor * to re-write urls as needed for this particular environment. * * Note, for a 'local' environment, no re-write is needed because this is - * handled at a higher level. For a 'production' env no rewrite is necc cause - * all source files are written for that environment. + * handled at a higher level. For other environments, only perform re-writing + * if the host, port, or scheme are different than https://browserid.org:443 + * (all source files always should have the production hostname written into them) */ exports.performSubstitution = function(app) { - if (g_config.hostname != 'browserid.org' || - g_config.port != '443' || - g_config.scheme != 'https') { + if ((g_config.hostname != 'browserid.org' || g_config.port != '443' || g_config.scheme != 'https') && + process.env['NODE_ENV'] !== 'local'){ app.use(substitution.substitute({ 'https://browserid.org': g_config['URL'], 'browserid.org:443': g_config['hostname'] + ':' + g_config['port'], @@ -171,7 +171,7 @@ exports.performSubstitution = function(app) { // At the time this file is required, we'll determine the "process name" for this proc // if we can determine what type of process it is (browserid or verifier) based -// on the path, we'll use that, otherwise we'll name it 'ephemeral'. +// on the path, we'll use that, otherwise we'll name it 'ephemeral'. if (process.argv[1] == path.join(__dirname, "..", "browserid", "run.js")) { g_config['process_type'] = 'browserid'; } else if (process.argv[1] == path.join(__dirname, "..", "verifier", "run.js")) {