From 719bbb115b517b9da45dcbbfa5a064681180ac4b Mon Sep 17 00:00:00 2001 From: David Glasser Date: Mon, 29 Jul 2013 23:21:08 -0700 Subject: [PATCH] Move bindToProxy to WebAppInternals; it is needed by the Galaxy proxy. --- packages/webapp/package.js | 3 +-- packages/webapp/webapp_server.js | 12 ++++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/webapp/package.js b/packages/webapp/package.js index c17c6f4683..e504c6b3d5 100644 --- a/packages/webapp/package.js +++ b/packages/webapp/package.js @@ -9,7 +9,6 @@ Npm.depends({connect: "2.7.10", Package.on_use(function (api) { api.use(['logging', 'underscore', 'routepolicy'], 'server'); - api.export('WebApp', 'server'); - api.export('main', 'server'); + api.export(['WebApp', 'main', 'WebAppInternals'], 'server'); api.add_files('webapp_server.js', 'server'); }); diff --git a/packages/webapp/webapp_server.js b/packages/webapp/webapp_server.js index 08f2aa5c1a..6cf8998cb1 100644 --- a/packages/webapp/webapp_server.js +++ b/packages/webapp/webapp_server.js @@ -12,11 +12,8 @@ var optimist = Npm.require('optimist'); var useragent = Npm.require('useragent'); var send = Npm.require('send'); -// XXX we have to export WebApp as a single symbol because we modify -// it (for example, it has an attribute httpServer which isn't known -// until runWebAppServer-time.) It would be nice to refactor so that -// this isn't the case and we can export the symbols individually. WebApp = {}; +WebAppInternals = {}; var findGalaxy = _.once(function () { if (!('GALAXY' in process.env)) { @@ -445,7 +442,7 @@ var runWebAppServer = function () { console.log("LISTENING"); // must match run.js var port = httpServer.address().port; if (bind.viaProxy && bind.viaProxy.proxyEndpoint) { - bindToProxy(bind.viaProxy); + WebAppInternals.bindToProxy(bind.viaProxy); } else if (bind.viaProxy) { // bind via the proxy, but we'll have to find it ourselves via // ultraworld. @@ -457,7 +454,7 @@ var runWebAppServer = function () { var doBinding = function (proxyService) { if (proxyService.providers.proxy) { Log("Attempting to bind to proxy at " + proxyService.providers.proxy); - bindToProxy(_.extend({ + WebAppInternals.bindToProxy(_.extend({ proxyEndpoint: proxyService.providers.proxy }, bind.viaProxy)); } @@ -482,8 +479,7 @@ var runWebAppServer = function () { }; }; -bindToProxy = function (proxyConfig) { - +WebAppInternals.bindToProxy = function (proxyConfig) { var securePort = proxyConfig.securePort || 4433; var insecurePort = proxyConfig.insecurePort || 8080; var bindPathPrefix = proxyConfig.bindPathPrefix || "";