LocalAI icon indicating copy to clipboard operation
LocalAI copied to clipboard

refactor: auth and metrics middlewares

Open dave-gray101 opened this issue 7 months ago • 3 comments

This refactor PR contains the following changes:

  • core/http/middleware has been created to hold non-endpoint specific HTTP code, rather than leaving it loose within app.go, as much as possible.
  • core/http/middleware/metrics.go is a file move - there should be no changes other than renames, but it belongs here now.
  • core/http/middleware/auth.go handles the creation of keyauth configuration data and contains the validation function specific to LocalAI.
  • actual implementation of auth has been temporarily moved to my keyauth v2 backport - I submitted and merged the required feature changes to fiber upstream, but v3 is not quite yet stable enough for us to target... hence this backport I made for us and future projects.
  • pkg/model/initializer.go - logging change that is helpful while debugging

Notably this does not include the common request infrastructure yet - that depends on #2773 but nothing in this PR does

dave-gray101 avatar Jul 15 '24 22:07 dave-gray101