hapipal / schwifty

A model layer for hapi integrating Objection ORM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plugin's knex instance should default to the root server's

devinivy opened this issue · comments

This is both,

  1. when Model.knexBind()ing during init and,
  2. when calling request.knex() and server.knex().

Yeah, actually it sort of does. I think I really just mean to update the behavior. That sets a special root knex instance as the first knex instance that's specified in any plugin. We would rather not rely on timing– the root knex instance should simply be the knex instance set when,

  1. registering the plugin, or
  2. calling server.schwifty() when server is the root server.

And it should be able to be specified at any point in time. In short, this feature is really about making sure that "order doesn't matter" when it comes to plugins (and the root server) declaring their knex instances.

Ok cool. So we're leaving it open for the root knex instance to be registered possibly after some plugins have registered. Yeah that whole block can be changed then, and the Hoek.assert can be removed (the one mentioned in description of #9 )

Yup, that block changed a fair amount in #13– would love some review!

On it