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

feat(certs-v5): add domain info in certs list and info #1660

Merged
merged 4 commits into from
Oct 28, 2020

Conversation

cafreeman
Copy link
Contributor

@cafreeman cafreeman commented Oct 20, 2020

https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07B0000008dFwjIAE/view

This PR adds two new pieces of functionality:

  1. The certs command will now show a count of associated domains for each cert in the list
  2. The certs:info command now has an optional --show-domains flag which, when used, will request and display the names of all the domains associated with the cert in question.

@cafreeman cafreeman changed the title add domain info in certs list and info feat(certs-v5): add domain info in certs list and info Oct 20, 2020
@cafreeman cafreeman marked this pull request as ready for review October 22, 2020 17:24
@cafreeman cafreeman requested a review from a team as a code owner October 22, 2020 17:24
@cafreeman cafreeman force-pushed the cfreeman/show-domains-in-certs-list branch from 7a423ff to a5ade61 Compare October 27, 2020 15:39
@cafreeman cafreeman force-pushed the cfreeman/show-domains-in-certs-list branch from 4bf44c2 to 58f71fa Compare October 27, 2020 17:36
@@ -14,6 +14,18 @@ function * run (context, heroku) {
headers: { 'Accept': `application/vnd.heroku+json; version=3.${endpoint._meta.variant}` }
}))

if (context.flags['show-domains']) {
let domains = yield Promise.all(endpoint.domains.map(domain => {
return heroku.request({
Copy link
Contributor

Choose a reason for hiding this comment

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

does this handle paginated responses?

// If they're using ACM it's not really worth showing the number of associated domains since
// it'll always be 1 and is entirely outside the user's control
if (!f.ssl_cert.acm) {
tableContents.associated_domains = (f.domains && f.domains.length) ? f.domains.length : '0'
Copy link
Contributor

Choose a reason for hiding this comment

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

I was a bit confused seeing this in the output and after reading the comment. What do you think about using 1 here instead of '0'? Or showing a blank space? 0 makes me think something isn't quite right since there is a cname for the cert. I might also be missing a key difference on the domains field vs the cname field.

Copy link
Contributor Author

@cafreeman cafreeman Oct 28, 2020

Choose a reason for hiding this comment

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

Ah, yes. The cname field is indicating the domain(s) provided when creating the cert. The "associated domains" field is referring to the number of actual connections made between this cert and actual domains that belong to the app on Heroku.

In other words, you may have a cert with a cname that reads "*.purple.com", and in Heroku, that cert could be assigned to "{foo,bar,baz}.purple.com" so you'd have 3 associated domains.

Likewise, you could have a cert uploaded that does not yet have any domains associated with it, in which case 0 seems like the best thing to display.

@cafreeman cafreeman merged commit 1920ff5 into master Oct 28, 2020
@cafreeman cafreeman deleted the cfreeman/show-domains-in-certs-list branch October 28, 2020 18:35
@cafreeman cafreeman mentioned this pull request Oct 29, 2020
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.

2 participants