mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Include appId in __meteor_runtime_config__ for deployed apps
This adds `appId` to the `config.json` generated by the bundler, and uses that in `boot.js` to initialize `process.env.APP_ID`. This is used by `autoupdate_server.js` to set `__meteor_runtime_config__`.
This commit is contained in:
@@ -1731,11 +1731,13 @@ class ServerTarget extends JsImageTarget {
|
||||
// options specific to this subclass:
|
||||
// - clientTarget: the ClientTarget to serve up over HTTP as our client
|
||||
// - releaseName: the Meteor release name (for retrieval at runtime)
|
||||
// - appIdentifier: the app identifier (for retrieval at runtime)
|
||||
constructor (options, ...args) {
|
||||
super(options, ...args);
|
||||
|
||||
this.clientTargets = options.clientTargets;
|
||||
this.releaseName = options.releaseName;
|
||||
this.appIdentifier = options.appIdentifier;
|
||||
|
||||
if (! archinfo.matches(this.arch, "os")) {
|
||||
throw new Error("ServerTarget targeting something that isn't a server?");
|
||||
@@ -1774,6 +1776,7 @@ class ServerTarget extends JsImageTarget {
|
||||
// server driver alongside the JsImage
|
||||
builder.writeJson("config.json", {
|
||||
meteorRelease: self.releaseName || undefined,
|
||||
appId: self.appIdentifier || undefined,
|
||||
clientPaths: clientTargetPaths
|
||||
});
|
||||
|
||||
@@ -2151,6 +2154,8 @@ exports.bundle = function ({
|
||||
var builtBy = "Meteor" + (release.current.name ?
|
||||
" " + release.current.name : "");
|
||||
|
||||
var appIdentifier = projectContext.appIdentifier;
|
||||
|
||||
var success = false;
|
||||
var serverWatchSet = new watch.WatchSet();
|
||||
var clientWatchSet = new watch.WatchSet();
|
||||
@@ -2204,6 +2209,7 @@ exports.bundle = function ({
|
||||
isopackCache: projectContext.isopackCache,
|
||||
arch: serverArch,
|
||||
releaseName: releaseName,
|
||||
appIdentifier: appIdentifier,
|
||||
buildMode: buildOptions.buildMode,
|
||||
providePackageJSONForUnavailableBinaryDeps
|
||||
};
|
||||
|
||||
@@ -31,6 +31,9 @@ __meteor_bootstrap__ = {
|
||||
configJson: configJson };
|
||||
__meteor_runtime_config__ = { meteorRelease: configJson.meteorRelease };
|
||||
|
||||
if (!process.env.APP_ID) {
|
||||
process.env.APP_ID = configJson.appId;
|
||||
}
|
||||
|
||||
// connect (and some other NPM modules) use $NODE_ENV to make some decisions;
|
||||
// eg, if $NODE_ENV is not production, they send stack traces on error. connect
|
||||
|
||||
Reference in New Issue
Block a user