- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1
 
Print new api key #60
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
Signed-off-by: OliverTrautvetter <[email protected]>
| It("should detect the old format and attempt to upgrade", func() { | ||
| cmd := exec.Command(cliPath, "version") | ||
| cmd.Env = append(os.Environ(), | ||
| "OMS_PORTAL_API_KEY=U4jsSHoDsOFGyEkPrWpsE", // 22 characters | 
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.
can we use something that's more obviously not a real API KEY like fakeapikeywith22charsa?
| } | ||
| opts.OmsPortalApiKey = newApiKey | ||
| 
               | 
          ||
| fmt.Fprintf(os.Stderr, "Successfully upgraded API key to new format!\n") | 
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.
I think this output is confusing and should be removed. This command will use the new env var, but outside, nothing will change right? So it's more a performance optimization for this specific execution of oms-cli. Not sure if it's even worth doing?
| fmt.Fprintf(os.Stderr, "Attempting to upgrade to the new format...\n\n") | ||
| 
               | 
          ||
| portalClient := portal.NewPortalClient() | ||
| newApiKey, err := portalClient.GetApiKeyByHeader(apiKey) | 
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.
I think it should be possible to concatenate the new API key in the client and only query the key ID from the portal, WDYT?
Feat: Auto-upgrade and output legacy API Keys
Implements logic in the OMS CLI to detect and handle legacy API keys. The CLI will now automatically query the OMS Portal to retrieve the missing Key ID, generate the new concatenated API key (
key_id + key), and output the new format to the user. This simplifies the user experience during the key migration.CU Card (ClickUp Task)