-
Notifications
You must be signed in to change notification settings - Fork 6
feat(auth): automatically fetch Columnar license on login #223
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
base: main
Are you sure you want to change the base?
Conversation
|
Nice! Let's also please make it so that if the user runs
If all three of those things are true, dbc should download |
e424e54 to
052c212
Compare
052c212 to
f59154c
Compare
|
@ianmcook updated per your suggestion |
|
Added @lidavidm so he can see where dbc is putting the license |
Nice! I tested it successfully. |
lidavidm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you log in and your trial is expired, you don't get any feedback:
$ dlv debug --headless ./cmd/dbc -- auth login
API server listening at: 127.0.0.1:39367
Opening https://auth.columnar.tech/activate?user_code=QVLR-GDCV in your default web browser...
Gtk-Message: 13:10:44.101: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.
Authentication successful!
In dlv, I can see that I got a 403:
> github.com/columnar-tech/dbc/auth.FetchColumnarLicense() ./auth/credentials.go:318 (PC: 0x978c8a)
313: if err != nil {
314: return err
315: }
316: defer resp.Body.Close()
317:
=> 318: if resp.StatusCode != http.StatusOK {
319: return fmt.Errorf("failed to fetch license: %s", resp.Status)
320: }
321:
322: licenseFile, err := os.OpenFile(licensePath, os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0o600)
323: if err != nil {
(dlv) p resp.StatusCode
403
But this is not reported in the UI.
e5e59dc to
c627606
Compare
|
I'm not sure if this is the same error as @lidavidm got but here's what I did:
Back in my terminal, the CLI is stuck on
I note that my trial is expired. Also I notice that the text says
but it should probably tell me that my license is expired. |
| return nil | ||
| }) | ||
| case nil: | ||
| return m, tea.Quit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looked fine to me but my auth command hung indefinitely. I think bubbletea doesn't like nil being used a signal.
| return nil | |
| }) | |
| case nil: | |
| return m, tea.Quit | |
| return tea.Quit() | |
| }) |
When using
dbc auth loginto login to the Columnar private registry, we'll check the token and see if it contains thetrial_startclaim, downloading the license if it exists.There's some more work that needs to happen here so I'm leaving this marked as WIP, such as: