mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
New way of interacting with galaxy now actually binds to proxy
This commit is contained in:
1
packages/galaxy/.gitignore
vendored
Normal file
1
packages/galaxy/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.build
|
||||
@@ -71,7 +71,7 @@ Galaxy.getAppConfig = function () {
|
||||
if (!subFuture.isResolved() && staticAppConfig)
|
||||
return staticAppConfig;
|
||||
subFuture.wait();
|
||||
var myApp = oneAppApps.findOne();
|
||||
var myApp = OneAppApps.findOne();
|
||||
if (myApp)
|
||||
return myApp.config;
|
||||
throw new Error("there is no app config for this app");
|
||||
@@ -93,18 +93,18 @@ Galaxy.configurePackage = function (packageName, configure) {
|
||||
};
|
||||
var subHandle;
|
||||
var observed = new Future();
|
||||
Meteor.startup(function () {
|
||||
// This is not required to finish, so defer it so it doesn't block anything
|
||||
// else.
|
||||
Meteor.defer( function () {
|
||||
collectionFuture.wait();
|
||||
subHandle = OneAppApps.find().observe({
|
||||
added: configureIfDifferent,
|
||||
changed: configureIfDifferent
|
||||
});
|
||||
observed.return();
|
||||
|
||||
// This is not required to finish, so defer it so it doesn't block anything
|
||||
// else.
|
||||
Meteor.defer( function () {
|
||||
collectionFuture.wait();
|
||||
subHandle = OneAppApps.find().observe({
|
||||
added: configureIfDifferent,
|
||||
changed: configureIfDifferent
|
||||
});
|
||||
observed.return();
|
||||
});
|
||||
|
||||
return {
|
||||
stop: function () {
|
||||
observed.wait();
|
||||
@@ -116,6 +116,8 @@ Galaxy.configurePackage = function (packageName, configure) {
|
||||
|
||||
Galaxy.configureService = function (serviceName, configure) {
|
||||
if (ultra) {
|
||||
collectionFuture.wait();
|
||||
console.log("subscribing to", serviceName);
|
||||
ultra.subscribe('servicesByName', serviceName);
|
||||
return Services.find({name: serviceName}).observe({
|
||||
added: configure,
|
||||
|
||||
@@ -3,7 +3,7 @@ Package.describe({
|
||||
});
|
||||
|
||||
Package.on_use(function (api) {
|
||||
api.use(['underscore', 'livedata']);
|
||||
api.use(['underscore', 'livedata', 'ejson']);
|
||||
api.use(['mongo-livedata'], {
|
||||
unordered: true
|
||||
});
|
||||
|
||||
@@ -377,6 +377,9 @@ var runWebAppServer = function () {
|
||||
// middlewares and update __meteor_runtime_config__, then keep going to set up
|
||||
// actually serving HTML.
|
||||
main = function (argv) {
|
||||
// main happens post startup hooks, so we don't need a Meteor.startup() to
|
||||
// ensure this happens after the galaxy package is loaded.
|
||||
var Galaxy = Package.galaxy.Galaxy;
|
||||
argv = optimist(argv).boolean('keepalive').argv;
|
||||
|
||||
var boilerplateHtmlPath = path.join(clientDir, clientJson.page);
|
||||
@@ -400,43 +403,41 @@ var runWebAppServer = function () {
|
||||
console.log("LISTENING"); // must match run.js
|
||||
var port = httpServer.address().port;
|
||||
var proxyBinding;
|
||||
Meteor.startup( function () {
|
||||
console.log("pre configurePackage");
|
||||
Galaxy.configurePackage('webapp', function (configuration) {
|
||||
console.log("in configurePackage", configuration);
|
||||
if (proxyBinding)
|
||||
proxyBinding.stop();
|
||||
if (configuration && configuration.proxy) {
|
||||
proxyBinding = Galaxy.configureService(function (proxyService) {
|
||||
if (proxyService.providers.proxy) {
|
||||
var proxyConf;
|
||||
if (process.env.ADMIN_APP) {
|
||||
proxyConf = {
|
||||
securePort: null,
|
||||
insecurePort: 9414,
|
||||
bindHost: "localhost",
|
||||
bindPathPrefix: "/" + process.env.GALAXY_APP
|
||||
};
|
||||
} else {
|
||||
proxyConf = {
|
||||
// TODO: allow sitename to be a list.
|
||||
bindHost: configuration.proxy.sitename
|
||||
};
|
||||
|
||||
}
|
||||
Log("Attempting to bind to proxy at " + proxyService.providers.proxy);
|
||||
WebAppInternals.bindToProxy(_.extend({
|
||||
proxyEndpoint: proxyService.providers.proxy
|
||||
}, proxyConf));
|
||||
console.log("pre configurePackage");
|
||||
Galaxy.configurePackage('webapp', function (configuration) {
|
||||
console.log("in configurePackage", configuration);
|
||||
if (proxyBinding)
|
||||
proxyBinding.stop();
|
||||
if (configuration && configuration.proxy) {
|
||||
proxyBinding = Galaxy.configureService("proxy", function (proxyService) {
|
||||
console.log("in configureService", proxyService);
|
||||
if (proxyService.providers.proxy) {
|
||||
var proxyConf;
|
||||
if (process.env.ADMIN_APP) {
|
||||
proxyConf = {
|
||||
securePort: null,
|
||||
insecurePort: 9414,
|
||||
bindHost: "localhost",
|
||||
bindPathPrefix: "/" + process.env.GALAXY_APP
|
||||
};
|
||||
} else {
|
||||
proxyConf = configuration.proxy;
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var callbacks = onListeningCallbacks;
|
||||
onListeningCallbacks = null;
|
||||
_.each(callbacks, function (x) { x(); });
|
||||
Log("Attempting to bind to proxy at " + proxyService.providers.proxy);
|
||||
WebAppInternals.bindToProxy(_.extend({
|
||||
proxyEndpoint: proxyService.providers.proxy
|
||||
}, proxyConf));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var callbacks = onListeningCallbacks;
|
||||
onListeningCallbacks = null;
|
||||
_.each(callbacks, function (x) { x(); });
|
||||
|
||||
}, function (e) {
|
||||
console.error("Error listening:", e);
|
||||
console.error(e.stack);
|
||||
|
||||
Reference in New Issue
Block a user