diff --git a/lib/app/autoload/action-context.common.js b/lib/app/autoload/action-context.common.js index a81877b6c..a9278023a 100644 --- a/lib/app/autoload/action-context.common.js +++ b/lib/app/autoload/action-context.common.js @@ -292,7 +292,7 @@ YUI.add('mojito-action-context', function(Y, NAME) { Y.mojito.hooks.hook('actionContext', opts.adapter.hook, 'start', my, opts); // HookSystem::EndBlock - staticAppConfig = store.getAppConfig(store.getStaticContext()); + staticAppConfig = store.getStaticAppConfig(); // It's possible to setup a route that calls "foo.", which means that // the default action in the instance should be used instead. diff --git a/lib/app/autoload/store.client.js b/lib/app/autoload/store.client.js index ab1f4293f..8051b1490 100644 --- a/lib/app/autoload/store.client.js +++ b/lib/app/autoload/store.client.js @@ -235,6 +235,16 @@ YUI.add('mojito-client-store', function(Y, NAME) { }, + /** + * Returns the static (non-runtime-sensitive) version of the application.json. + * @method getStaticAppConfig + * @return {object} the configuration from applications.json + */ + getStaticAppConfig: function(ctx) { + return this.appConfig; + }, + + /** * Returns the routes configured in the application. * @method getRoutes diff --git a/lib/mojito.js b/lib/mojito.js index 6c4a62dbc..7369498fe 100644 --- a/lib/mojito.js +++ b/lib/mojito.js @@ -275,7 +275,7 @@ MojitoServer.prototype._configureAppInstance = function(app, options) { options.context = {}; } - appConfig = store.getAppConfig(store.getStaticContext()); + appConfig = store.getStaticAppConfig(); yuiConfig = (appConfig.yui && appConfig.yui.config) || {}; // redefining "combine" and/or "base" in the server side have side effects diff --git a/tests/unit/lib/app/autoload/test-action-context.common.js b/tests/unit/lib/app/autoload/test-action-context.common.js index 5cca66721..963451857 100644 --- a/tests/unit/lib/app/autoload/test-action-context.common.js +++ b/tests/unit/lib/app/autoload/test-action-context.common.js @@ -13,6 +13,9 @@ YUI().use('mojito-action-context', 'test', function (Y) { getAppConfig: function() { return 'app config'; }, + getStaticAppConfig: function() { + return 'static app config'; + }, getStaticContext: function() { return 'static context'; }, @@ -596,6 +599,9 @@ YUI().use('mojito-action-context', 'test', function (Y) { actionTimeout: 1 }; }, + getStaticAppConfig: function() { + return 'static app config'; + }, getStaticContext: function() { return 'static context'; }, @@ -650,6 +656,9 @@ YUI().use('mojito-action-context', 'test', function (Y) { actionTimeout: 1000 }; }, + getStaticAppConfig: function() { + return 'static app config'; + }, getStaticContext: function() { return 'static context'; }, @@ -702,6 +711,9 @@ YUI().use('mojito-action-context', 'test', function (Y) { actionTimeout: 1000 }; }, + getStaticAppConfig: function() { + return 'static app config'; + }, getStaticContext: function() { return 'static context'; }, @@ -836,6 +848,9 @@ YUI().use('mojito-action-context', 'test', function (Y) { getAppConfig: function() { return {}; }, + getStaticAppConfig: function() { + return 'static app config'; + }, getStaticContext: function() { return {}; }, @@ -981,6 +996,11 @@ YUI().use('mojito-action-context', 'test', function (Y) { pathToRoot: '/path/to/root/' }; }, + getStaticAppConfig: function() { + return { + pathToRoot: '/path/to/root/' + }; + }, getStaticContext: function() { return 'static context'; },