Improve data flow from deployConfig to mongo-livedata.

(Still ought to be better refactored though.)
This commit is contained in:
David Glasser
2013-07-29 11:54:52 -07:00
parent 3b03386b63
commit 3e76c40cce
3 changed files with 11 additions and 4 deletions

View File

@@ -26,6 +26,10 @@ Package.on_use(function (api) {
// Allow us to detect 'autopublish', and publish collections if it's loaded.
api.use('autopublish', 'server', {weak: true});
// RemoteCollectionDriver gets its deployConfig from something that is (for
// questionable reasons) initialized by the webapp package.
api.use('webapp', 'server', {weak: true});
api.export('MongoLivedataTest', 'server', {testOnly: true});
api.add_files('mongo_driver.js', 'server');

View File

@@ -23,9 +23,10 @@ _.extend(RemoteCollectionDriver.prototype, {
// you're only trying to receive data from a remote DDP server.)
getRemoteCollectionDriver = _.once(function () {
// XXX kind of hacky
var mongoUrl = (typeof __meteor_bootstrap__ !== 'undefined' &&
Meteor._get(__meteor_bootstrap__.deployConfig,
'packages', 'mongo-livedata', 'url'));
var mongoUrl = (
typeof __meteor_bootstrap__ !== 'undefined' &&
Meteor._get(__meteor_bootstrap__,
'deployConfig', 'packages', 'mongo-livedata', 'url'));
// XXX bad error since it could also be set directly in METEOR_DEPLOY_CONFIG
if (! mongoUrl)
throw new Error("MONGO_URL must be set in environment");

View File

@@ -183,7 +183,9 @@ var runWebAppServer = function () {
throw new Error("Unsupported format for client assets: " +
JSON.stringify(clientJson.format));
// XXX change all this config to something more reasonable
// XXX change all this config to something more reasonable.
// and move it out of webapp into a different package so you don't
// have weird things like mongo-livedata weak-dep'ing on webapp
var deployConfig =
process.env.METEOR_DEPLOY_CONFIG
? JSON.parse(process.env.METEOR_DEPLOY_CONFIG) : {};