> On Jan 30, 2015, at 12:43 PM, Paulo Antonio McNally Zambrana <
paulom...@gmail.com> wrote:
>
> How to get req.app.kraken.get('api_url'); from a model with krakenJS?
>
> req its from a route, but i a need set api_url into a model.
Good question! Kraken's configurations are pretty isolated -- usually, having to do this is a smell that things aren't as separate as they should be (presentation layer things mixed with business logic), but sometimes that's how it works out.
You can attach an onconfig handler to kraken in index.js, which, when called, can inject the configuration into the model. Just be aware that it's asynchronous, so don't rely on it until onconfig has fired, or the app emits the start event.
Aria