Skip to content

POST license API endpoint #3570

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

Merged
merged 9 commits into from
Aug 22, 2022
Merged

POST license API endpoint #3570

merged 9 commits into from
Aug 22, 2022

Conversation

spikecurtis
Copy link
Contributor

PR 1 of 2 for #3279

(next PR will add the coder license add CLI command that hits this endpoint

  • POST license API
  • Support interface{} types in generated Typescript

Signed-off-by: Spike Curtis <spike@coder.com>
Signed-off-by: Spike Curtis <spike@coder.com>
@spikecurtis spikecurtis requested review from kylecarbs and a team August 18, 2022 22:10
@spikecurtis spikecurtis requested a review from a team as a code owner August 18, 2022 22:10
Copy link
Contributor

@presleyp presleyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

frontend ✅

Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of this looks great! I noted a few minor things and I think we could do something nicer with License.Claims for the frontend (like defining the known fields). Users of codersdk might also benefit from exposing known fields.

Signed-off-by: Spike Curtis <spike@coder.com>
Signed-off-by: Spike Curtis <spike@coder.com>
//go:embed keys/2022-08-12
var key20220812 []byte

var keys = map[string]ed25519.PublicKey{"2022-08-12": ed25519.PublicKey(key20220812)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make a coderd.API struct that contains this? Similar to how the AGPL coderd package is structured.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the public keys are baked in at the package level this way. Isn't this what we want?

It might make it easier to do integration testing if we could inject the keys in as coderd.Options on creation of the API, so that tests could generate their own keys and then use them, but I worry that sort of machinery would be tempting for end users looking to bypass our licensing. Granted, right now they can just modify the keys/2022-08-12 file, but each layer we bubble this up through makes it that much more obvious how to get away with it.

@@ -0,0 +1,153 @@
package coderd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this test doesn't have to be internal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it modifies the keys variable in-place during the tests (patch paradigm). I want to keep that variable unexported, so the tests need to be internal.

Signed-off-by: Spike Curtis <spike@coder.com>
Signed-off-by: Spike Curtis <spike@coder.com>
@spikecurtis spikecurtis merged commit b101a6f into main Aug 22, 2022
@spikecurtis spikecurtis deleted the spike/3279_post_license branch August 22, 2022 22:02
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.

5 participants