From ea585fd0e8fe64e64d0aa5c58a89eb35a8f6c7a1 Mon Sep 17 00:00:00 2001 From: Lennart kats Date: Wed, 1 Jul 2015 08:20:12 +0000 Subject: [PATCH 1/3] Fix not passing host --- node_modules/c9/urls.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node_modules/c9/urls.js b/node_modules/c9/urls.js index 04ca1edb..e1e9362c 100644 --- a/node_modules/c9/urls.js +++ b/node_modules/c9/urls.js @@ -34,7 +34,7 @@ plugin.getBaseUrl = function(req, sourceBaseUrlPattern, targetBaseUrlPattern) { || req.host || req.url && req.url.replace(/^https?:\/\/([^/]*).*/, "$1") || req; - assert(!sourceHost.match(/\$DOMAIN/), "Please provide a valid request object"); + assert(typeof sourceHost === "string", "Not a valid request object: " + JSON.stringify(req)); var sourceHostMatcher = sourceBaseUrlPattern .replace(/^https?:\/\//, "") From 4477a5f1243fa34b2d990b032cfc14a973ae573a Mon Sep 17 00:00:00 2001 From: Lennart kats Date: Wed, 1 Jul 2015 08:44:36 +0000 Subject: [PATCH 2/3] Fix circular json error --- node_modules/c9/urls.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/node_modules/c9/urls.js b/node_modules/c9/urls.js index e1e9362c..7484194b 100644 --- a/node_modules/c9/urls.js +++ b/node_modules/c9/urls.js @@ -34,7 +34,8 @@ plugin.getBaseUrl = function(req, sourceBaseUrlPattern, targetBaseUrlPattern) { || req.host || req.url && req.url.replace(/^https?:\/\/([^/]*).*/, "$1") || req; - assert(typeof sourceHost === "string", "Not a valid request object: " + JSON.stringify(req)); + if (typeof sourceHost !== "string") + throw new Error("Not a valid request object: " + req); var sourceHostMatcher = sourceBaseUrlPattern .replace(/^https?:\/\//, "") From c3bf86e76e8475b29c61e23f32ebae65a80b6d9a Mon Sep 17 00:00:00 2001 From: Lennart kats Date: Wed, 1 Jul 2015 09:43:59 +0000 Subject: [PATCH 3/3] Add C9_DOMAINS environment variable --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index 6cb21bb1..2711230c 100755 --- a/server.js +++ b/server.js @@ -63,7 +63,7 @@ function main(argv, config, onLoaded) { .describe("dump", "dump config file as JSON") .describe("domains", "Primary and any secondary top-level domains to use (e.g, c9.io,c9.dev)") .describe("exclude", "Exclude specified service") - .default("domains", inContainer && process.env.C9_HOSTNAME) + .default("domains", inContainer && process.env.C9_HOSTNAME || process.env.C9_DOMAINS) .boolean("help") .describe("help", "Show command line options.");