Using Valet Linux on Windows with WSL2 can be a bit tricky, but it is possible to make it work. Here are the steps you can follow:
-
Update DNS settings in the WSL network adapter with the WSL instance's local IP. This can be done by modifying the name server records for dnsmasq. You mentioned that you have already automated this step, which is great.
-
Add the generated Valet certificate to Windows to make it trusted locally. This step is still manual and needs to be done each time. You can follow these steps to add the certificate:
- Open the certificate manager on Windows by pressing Win + R and typing
certlm.msc. - Navigate to "Trusted Root Certification Authorities" > "Certificates".
- Right-click and choose "All Tasks" > "Import".
- Select the generated Valet certificate and follow the import wizard.
- Open the certificate manager on Windows by pressing Win + R and typing
-
Update dnsmasq configs to allow connections from the host Windows computer. This step can also be automated.
By following these steps, you have managed to automate most of the process. However, it's important to note that Valet Linux does not officially support WSL. So, there might be other problems that you could encounter while using it. It's always a good idea to keep an eye on the official documentation or community forums for any updates or workarounds.
If you have any further questions or need assistance with specific issues, feel free to ask.