Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

static context should be applied to runtime context #1274

Open
drewfish opened this issue Oct 29, 2013 · 5 comments
Open

static context should be applied to runtime context #1274

drewfish opened this issue Oct 29, 2013 · 5 comments
Labels

Comments

@drewfish
Copy link
Contributor

In the contextualizer middleware, the static context (the context given when the app was started) was not reflected in the runtime context available to the middleware (or to controllers as well). This static context should be added into the runtime context. Also, it should have higher precedence (override) than any runtime context.

@caridy
Copy link
Contributor

caridy commented Oct 29, 2013

what if we do this when dispatching a new mojit (right before expanding the instance), or doing it right inside the store method to expand the mojit instance.

@caridy
Copy link
Contributor

caridy commented Mar 3, 2014

I think we solved this a while ago. /cc @lzhan @imalberto

@aljimenez
Copy link
Contributor

I just noticed that Drew had mentioned this issue before me. Pull request #1378 addresses this, although the request's context takes precedence. I think the req's context should take precedence because I see it as a more specific context than the static context. This allows the static context to serve as the default set of dimension values which can be overwritten by a request.

@drewfish
Copy link
Contributor Author

drewfish commented Jun 2, 2014

Does that mean that I can add ?environment=production to a query parameter and hit the production database (even on a staging server) ?

@aljimenez
Copy link
Contributor

The contextualizer middleware doesn't set the req's environment based on a query parameter: https://github.com/yahoo/mojito/blob/develop/lib/app/middleware/mojito-contextualizer.js#L148. It only does so for dimensions such as lang, site, device, and region. If we make the req's context take precedence we can, for example, have a default value for "site", set at start up, which can be overwritten by a request. If we make the start up context take precedence, then a developer might, for example, set a device value at startup and then the request wont be able to overwrite it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants