liuweiGL / vite-plugin-mkcert

Provide certificates for vite's https dev service.
https://www.npmjs.com/package/vite-plugin-mkcert
MIT License
584 stars 37 forks source link

[Feature Request] Copy the rootCA file into the project's directory #58

Closed evsar3 closed 1 year ago

evsar3 commented 1 year ago

First, congratulations! this is a great Vite Plugin and it's being very useful.

I would like to suggest that when the mkcert is initialized and the rootCA is generated, the rootCA.crt file could be could be copied into the project's root directory. A disclaimer that the file must be gitignored can be used to warn the user that the file should not be pushed into the remote repository.

Another solution could be a custom command that could be invoked via npx and copy the rootCA file into the project 's directory. Example:

npx vite-plugin-mkcert copy-ca

Thanks.

liuweiGL commented 1 year ago

Why put the ca in the project, what do you want to do

evsar3 commented 1 year ago

Many times the development workflow requires that you install the CA in other devices. I couldn't find any API on the plugin that exposes the CA so it could be exported/copied.

The mkcert -CAROOT requires additional installation (at least on MacOS) where I had to install the mkcert via homebrew just to expose the CA location.

If the CA location is known by the plugin, an additional installation for mkcert should not be necessary.

Looking up for devcert used on my Express backend, it has something useful which is the the getCABuffer option that does something like what I'm suggestion.

liuweiGL commented 1 year ago

:tada: This issue has been resolved in version 1.12.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

liuweiGL commented 1 year ago

Now you can use the savePath parameter to customize the location, or find it here

jaulz commented 1 year ago

This broke my existing setup because it suddenly uses a different root CA. Maybe this behaviour should only apply when the path is explicitly set to "."?

liuweiGL commented 1 year ago

Sorry to cause you trouble, but this change should only make you reinstall the CA?

liuweiGL commented 1 year ago

Can you explain in detail the problem you are having, i will submit a path if necessary.

liuweiGL commented 1 year ago

59

jaulz commented 1 year ago

No worries, I still need to pin down the issue but suddenly my old root CA was not used anymore and since I shared it with another device it was not working there anymore. So I assume that suddenly a different root certificate was used after this change.