-
Notifications
You must be signed in to change notification settings - Fork 79
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(subject_alt_names): Allow multiple subject_alt_names #34
base: master
Are you sure you want to change the base?
Conversation
This would be a welcome addition. Might also be a good idea to allow IP addresses |
yarn.lock
Outdated
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.8.1.tgz#6946af2d1d651a7b1863b531d6e5afa41aa44eac" | ||
tslib@^1.10.0: | ||
version "1.10.0" | ||
resolved "https://system1.jfrog.io/system1/api/npm/npm-virtual/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" |
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.
Think you're accidentally pointing to your private registry?
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.
Nice catch @chimurai
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.
update: i actually have some more concerns about this, see later review
@jamsea This is a really useful addition, so I'm gonna update these to fix them and then merge it.
Fair warning: I'm gonna try to back out your dependency updates completely, since I'm not sure they are strictly necessary for this PR, and they should maybe come in a separate one. I'll do a full regression.
yarn.lock
Outdated
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.8.1.tgz#6946af2d1d651a7b1863b531d6e5afa41aa44eac" | ||
tslib@^1.10.0: | ||
version "1.10.0" | ||
resolved "https://system1.jfrog.io/system1/api/npm/npm-virtual/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" |
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.
Nice catch @chimurai
95f2bd5
to
08038ba
Compare
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.
Thanks again for the submission; this is really useful. I have some recommended code changes as well as a couple questions.
@@ -27,7 +27,7 @@ | |||
"homepage": "https://github.com/davewasmer/devcert#readme", | |||
"devDependencies": { | |||
"standard-version": "^4.3.0", | |||
"typescript": "^2.7.0" | |||
"typescript": "^2.9.2" |
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.
Did you find that you needed to update typescript and tslib for your changes to work? If not, I'd like to save dep updates for separate PRs.
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.
@zetlen yes, at the time I needed to update typescript for flatMap
to work
@@ -2,6 +2,9 @@ | |||
"compileOnSave": false, | |||
"compilerOptions": { | |||
"declaration": true, | |||
"lib": [ |
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.
Same question as the dependency updates: is it possible to break this into another PR?
export async function certificateFor(domain: string, options: Options = {}) { | ||
debug(`Certificate requested for ${ domain }. Skipping certutil install: ${ Boolean(options.skipCertutilInstall) }. Skipping hosts file: ${ Boolean(options.skipHostsFile) }`); | ||
export async function certificateFor(domains: string | string[], options: Options = {}) { | ||
const domain = Array.isArray(domains) ? domains[0] : domains; |
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 appreciate the backwards-compatibility efforts here. I recommend that you simplify the following code by making domains
always an array and then using domains
only for the rest of the code. Then you can remove the conditionals for when it's one domain.
-export async function certificateFor(domains: string | string[], options: Options = {}) {
- const domain = Array.isArray(domains) ? domains[0] : domains;
+export async function certificateFor(requestedDomains: string | string[], options: Options = {}) {
+ const domains = Array.isArray(requestedDomains) ? requestedDomains : [requestedDomains]
If you do that, you can rename all the other private identifiers to plurals so the code is easier to read, so pathForDomain
becomes pathForDomains
et cetera. This makes the types easier to follow!!
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.
Cool @zetlen , I thought that too I just wanted to save the backward compatibility. If we're not bothered about backward compatibility (it's really not that big of a deal if we do a major version bump) I'll change this
@@ -15,7 +15,8 @@ const debug = createDebug('devcert:certificates'); | |||
* individual domain certificates are signed by the devcert root CA (which was | |||
* added to the OS/browser trust stores), they are trusted. | |||
*/ | |||
export default async function generateDomainCertificate(domain: string): Promise<void> { | |||
export default async function generateDomainCertificate(domains: string | string[]): Promise<void> { | |||
const domain = Array.isArray(domains) ? domains[0] : domains; |
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 is an example of the kind of code you can simplify if you cast a request for a single domain into an array of length 1 earlier in the process.
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.
Good idea!
What happened to this PR? Need help? |
@@ -2,6 +2,9 @@ | |||
"compileOnSave": false, | |||
"compilerOptions": { | |||
"declaration": true, | |||
"lib": [ | |||
"esnext" | |||
], |
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.
While running the PR branch, it seems as though this pull request requires upgrades to Node environment, with the usage of functions like flatMap
requiring Node 11+ unless this line is removed from tsconfig
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.
@camsjams if it were me, I'd forego the use of flatMap()
altogether. A single reduce()
(as opposed to flatMap().map()
) would solve the problem, I think, and would be better supported.
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.
Yup, I upgraded it because of flatMap
at the time.
@Js-Brecht sorry! All my notifications were going through an email filter 🤦♂ I just noticed now because I saw a push notification on my phone. I'll take a read now |
@camsjams if you're free this week and want to take this over that'd be helpful. I'm on another project now so I wouldn't be able to get this until next week. I'll fix notifications so I'm available though |
I can take this on, I will probably submit a new PR with the suggestions applied and more minimal changes. I was successfully able to use this feature add to create multiple alt names locally so I am happy to get this merged into the main branch. |
Maintainer here. I prefer to call it "periodically maintained". Most of the codebase is mature; additional fun stuff would require a big refactor, which I'd probably put in a new library. But even bugfixes require a pretty big regression, using multiple VMs; a lot of the code directly touches OS features, so the only useful testing is end-to-end. So that slows down the processing of PRs somewhat. Thanks very much in advance for your help, @camsjams. As soon as you've updated this, I can get it merged fast. |
No offense meant, @zetlen. You guys have done a great job on this project, and the fact that it needs little maintenance is an excellent indicator of that. |
I've have submitted a new PR (#91) with exactly this feature. I hope the maintainer could merge it someday... 🤞 |
Bumps [@types/configstore](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/configstore) from 2.1.1 to 4.0.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/configstore) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Related to: #33 allows a user to pass in multiple domain names for one certificate without introducing breaking API changes.