Fixes#756
Previously if `php` was installed as just `php` (the default Homebrew alias), Valet would not detect *which* PHP version was actually installed, and therefore `valet use` might do incorrect or unnecessary installations/links/etc.
NOTE: This does NOT "convert" existing `php` alias to a numbered version. It merely accepts it as-is, but notes its version in an attempt to avoid extra installations.
*NOTE: Specifally tested with PHP 7.4 and 7.3. No promises about old 5.6, etc aliases.*
Thanks to the generosity of Alan at Ngrok, I've been able to do some additional testing with temporary added features.
Turns out #864 was incomplete. This PR now also loops through the default endpoints in order to find a process matching the passed domain.
Ref: #864
Ref: #145
`valet uninstall` only displays information about how to manually uninstall and clean up after Valet.
This PR adds a `--force` parameter, which will forcefully remove Valet and the Homebrew services it installs, as well as clean up the config files and log files.
But for a few post-uninstall composer dependencies, cleanup is very thorough.
This brings idempotency to both `valet install` and `valet uninstall --force`
(There may still be edge cases where other Homebrew or composer packages might create interference with install/uninstall, but this makes things much easier to self-troubleshoot.)
This allows the valet configuration to stand separately from the default PHP config.
This benefits troubleshooting, makes customization of FPM workers and other settings easer
and allows for easier uninstallation.
Also renames any previously-existing `www.conf` pool config so it doesn't conflict with Valet nor run unnecessary additional processes.
Ngrok Pro plans allow multiple processes, which means you could be serving several sites simultaneously. This PR allows Valet to correctly identify amongst the active ngrok process URLs.
Fixes#145
This PR changes Valet's default config process to empower this feature, which makes installation less intrusive, and easier to identify and remove valet-specific customizations.
This will make for easier troubleshooting
... and easier customizing (such as dropping in a custom logging config, additional TLDs, alternate DNS resolvers, etc)
Also removes old dnsmasq configs used by prior Valet versions
This PR allows passing `--all` to `valet unsecure` to have it remove all certificates from all Valet configs AND from the MacOS Keychain.
This effectively cleans up certificate fragments or broken configs, and can help with troubleshooting.
While it's rare that the dnsmasq won't be started, it feels incomplete to not include the service when starting/restarting valet, since valet depends on it.
While since #268 valet has been checking nginx configs for errors when starting/restarting, the captured errors are never displayed if there is a failure because it's being run using `quietly()`.
This PR causes the errors to pass through to the console so we can more readily understand why nginx may not be starting or not serving properly.
If you've previously run `valet trust` to allow valet to run without specifying `sudo` repeatedly or entering your password with various valet commands, recent updates to MacOS may give you a `sudo: sorry, you are not allowed to preserve the environment` response when trying to run those `valet` commands.
The fix is in updating the sudoers entry that `valet trust` creates.
This PR tells valet how to update the sudoers entry so that this message doesn't continue.
YOU WILL NEED TO RE-RUN `valet trust` IF YOU HAD PREVIOUSLY RUN IT, after installing this update, in order for this code change to have any effect.
(Technical explanation: the sudoers protections have become stricter, so we have to be more explicit that we do indeed want environment variables to flow through to the sudo user's environment when using valet via sudoers entries.)
Should always provide CAserial, but should only provide CAcreateserial if file does not exist. Should probably fix permissions issue mentioned in the comments when attempting to create certificate.