Allow config package to export app collection

This commit is contained in:
Naomi Seyfer
2013-09-18 12:13:41 -07:00
parent 7ed9342442
commit 84cd4e9395
3 changed files with 10 additions and 19 deletions

View File

@@ -7,19 +7,14 @@ AppConfig.findGalaxy = _.once(function () {
if (!('GALAXY' in process.env || 'ULTRAWORLD_DDP_ENDPOINT' in process.env)) {
return null;
}
return Follower.connect(process.env.ULTRAWORLD_DDP_ENDPOINT || process.env.GALAXY);
});
// TODO: Eventually, keep track of the replica set, and generally be conected to the
// leader. Waiting on actually having that concept implemented in ultraworld.
var ultra = AppConfig.findGalaxy();
var subFuture = new Future();
if (ultra)
ultra.subscribe("oneApp", process.env.GALAXY_APP, subFuture.resolver());
var OneAppApps;
var Services;
var collectionFuture = new Future();
@@ -37,6 +32,12 @@ Meteor.startup(function () {
}
});
// XXX: Remove this once we allow the same collection to be new'd from multiple
// places.
AppConfig._getAppCollection = function () {
collectionFuture.wait();
return OneAppApps;
};
var staticAppConfig;
@@ -73,7 +74,7 @@ AppConfig.getAppConfig = function () {
return staticAppConfig;
}
subFuture.wait();
var myApp = OneAppApps.findOne();
var myApp = OneAppApps.findOne(process.env.GALAXY_APP);
if (myApp)
return myApp.config;
throw new Error("there is no app config for this app");
@@ -102,7 +103,7 @@ AppConfig.configurePackage = function (packageName, configure) {
// there's a Meteor.startup() that produces the various collections, make
// sure it runs first before we continue.
collectionFuture.wait();
subHandle = OneAppApps.find().observe({
subHandle = OneAppApps.find(process.env.GALAXY_APP).observe({
added: configureIfDifferent,
changed: configureIfDifferent
});

View File

@@ -18,17 +18,6 @@
"cookie": {
"version": "0.0.5"
},
"send": {
"version": "0.1.0",
"dependencies": {
"mime": {
"version": "1.2.6"
},
"range-parser": {
"version": "0.0.4"
}
}
},
"bytes": {
"version": "0.2.0"
},

View File

@@ -411,7 +411,8 @@ var runWebAppServer = function () {
if (proxyBinding)
proxyBinding.stop();
if (configuration && configuration.proxy) {
proxyBinding = AppConfig.configureService(configuration.proxyServiceName || "proxy", function (proxyService) {
proxyBinding = AppConfig.configureService(configuration.proxyServiceName ||
"proxy", function (proxyService) {
if (proxyService.providers.proxy) {
var proxyConf;
if (process.env.ADMIN_APP) {