From dbe6edf11c92f973d628e44ddde71afc69e43da1 Mon Sep 17 00:00:00 2001 From: Geoff Schmidt Date: Mon, 6 Jan 2014 22:23:56 -0800 Subject: [PATCH] read ROOT_URL from environment in commands.js, not runner.js --- tools/commands.js | 2 ++ tools/run-mongo.js | 11 ----------- tools/runner.js | 17 ++++++++--------- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/tools/commands.js b/tools/commands.js index 21b4aa0b02..46d2034fe1 100644 --- a/tools/commands.js +++ b/tools/commands.js @@ -155,6 +155,7 @@ main.registerCommand({ buildOptions: { minify: options.minify }, + rootUrl: process.env.ROOT_URL, mongoUrl: process.env.MONGO_URL, oplogUrl: process.env.MONGO_OPLOG_URL, once: options.once @@ -981,6 +982,7 @@ main.registerCommand({ settingsFile: options.settings, banner: "Tests", buildOptions: buildOptions, + rootUrl: process.env.ROOT_URL, mongoUrl: process.env.MONGO_URL, oplogUrl: process.env.MONGO_OPLOG_URL, once: options.once diff --git a/tools/run-mongo.js b/tools/run-mongo.js index 6e135d91d6..60533e789f 100644 --- a/tools/run-mongo.js +++ b/tools/run-mongo.js @@ -292,17 +292,6 @@ _.extend(MongoRunner.prototype, { // // If the server fails to start for the first time (after a few // restarts), we'll print a message and give up, returning false. - // - // XXX XXX this is a change in behavior -- before, whenever mongo - // crashed we would restart the app. now they are independent. will - // apps tolerate that, or will they die immediately on startup if - // they can't make an initial database connection? we should look - // into that ... but really, if you think about it, that's not the - // right way for apps to behave in a HA environment, because there - // is always a race where they fail to start (I suppose you could - // take the position that they should be restarted if they fail, - // after a short time delay.. but still, that approach will tend to - // amplify failures) start: function () { var self = this; diff --git a/tools/runner.js b/tools/runner.js index e80d84f809..a393a23a9f 100644 --- a/tools/runner.js +++ b/tools/runner.js @@ -19,13 +19,15 @@ var Updater = require('./updater.js').Updater; // - add warnings to buildmessage, per slava // - make files.getSettings return errors instead of throwing (or eliminate) // - mv main.js to meteor.js -// - search for XXX here and there +// - deal with XXX's in updater about it needing to go though runlog since +// no more stdout redirection +// - kill process.exit everywhere // /////////////////////////////////////////////////////////////////////////////// // options: port, buildOptions, settingsFile, banner, program, -// onRunEnd, onFailure, watchForChanges, noListenBanner, disableOplog, -// rawLogs, appDirForVersionCheck +// onRunEnd, onFailure, watchForChanges, noListenBanner, rootUrl, +// mongoUrl, oplogUrl, disableOplog, rawLogs, appDirForVersionCheck var Runner = function (appDir, options) { var self = this; self.appDir = appDir; @@ -37,11 +39,6 @@ var Runner = function (appDir, options) { self.appPort = self.listenPort + 1; self.mongoPort = self.listenPort + 2; - // XXX XXX have this be passed in, not slurped from the environment - self.rootUrl = - var rootUrl = process.env.ROOT_URL || - ('http://localhost:' + self.listenPort + '/'); - self.banner = options.banner || files.prettyPath(self.appDir); self.runLog = new RunLog({ @@ -81,7 +78,7 @@ var Runner = function (appDir, options) { mongoUrl: mongoUrl, oplogUrl: oplogUrl, buildOptions: options.buildOptions, - rootUrl: self.rootUrl, + rootUrl: options.rootUrl || ('http://localhost:' + self.listenPort + '/'), settingsFile: options.settingsFile, program: options.program, proxy: self.proxy, @@ -148,6 +145,8 @@ _.extend(Runner.prototype, function () { // - banner: replace the application path that is normally printed on // startup with an arbitrary string (eg, 'Tests') // - rawLogs: don't colorize/beautify log messages that are printed +// - rootUrl: tell the app that traffic at this URL will be routed to +// it at '/' (used by the app to construct absolute URLs) // - disableOplog: don't use oplog tailing // - mongoUrl: don't start a mongo process; instead use the mongo at // this mongo URL