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

Draft of wrapping more LCP license functionality into the library instead of handlers. #321

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tm-bookshop
Copy link

@tm-bookshop tm-bookshop commented Jun 29, 2023

Goal: Wrap more of the functionality of LCP server into exported functions that can be used as a library from other Go services.

For example it seems useful to wrap validation things like checkGetLicenseInput, copyInputToLicense, buildLicense, etc inside a single, exported function that can be called from outside an HTTP handler.

Context:

  • We'd like to use the LCP/LSD servers as libraries in our existing Go project so we don't have the additional Ops overhead of running additional servers
  • I am assuming will we want input validation on partial licenses and other inputs to the LCP license handlers - this was the motivation for moving more things into the exported license.go functions

Some other changes in this PR:

  • A couple of the HTTP response codes in the license handlers has changed. To try to not change them too much, I introduced a new Error that wraps more detailed input-validation error messages

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

Successfully merging this pull request may close these issues.

1 participant