Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model schemas are strictly required even when auth policies are not used. #760

Open
kevinswiber opened this issue Jun 22, 2018 · 2 comments
Labels

Comments

@kevinswiber
Copy link
Member

config.loadModels();

EG is using a singleton config object. It attempts to load models early, even if no auth policies are used. This means users MUST include models no matter what.

Consider relaxing this requirement and look at lazy-loading based on runtime needs.

@jtsampson
Copy link

jtsampson commented Jun 23, 2018

Are the models exclusively used by the Admin Server or are they also tied policies or other parts of they system?

If the former case, then this seems like a simple case of removing config.loadModels(); from config/index.js and adding the following to config.js:

  loadConfig (type) {
    // ...load config object
    if (type === 'gateway' && config.admin) {
      this.loadModels();
    }
    //...
  }

As well ad addressing the dereferencePromise in services/consumers/credentials/credential.service.js which assumes that the models exist.

const dereferencePromise = refParser.dereference(config.models.credentials).then(derefSchema => mergeAllOf(derefSchema));

Would that work?

@XVincentX
Copy link
Member

This is going to require some work on our side. @jtsampson you correctly identified two spots where changing the strategy from eager to lazy loading would break, but I'm almost sure there would be other places.

I think the first place where we should start changing the code is the one that is looping through the policies array — and see if we can avoid to load there.

Perhaps (perhaps) — that array is completely useless as we can discovery the policies to load by ourselves. Once this'll be scheduled, I'll have a further look into.

@altsang altsang added this to Backlog in express-gateway Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

No branches or pull requests

3 participants