1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-11-06 12:50:06 +01:00

🐛 Fix issue with securing domains

If you serve a single folder locally multiple times, e.g. as
`cdn.mydomain.test` and `mydomain.test`, securing would fail
for domain that came alphabetically last.

This has been resolved if you are running Valet 3 or newer by
leveraging the `valet secure $domain` syntax.
This commit is contained in:
2025-07-28 11:22:23 +02:00
parent 96975f8e57
commit ca65fca77d
2 changed files with 15 additions and 7 deletions

View File

@@ -51,7 +51,15 @@ class ValetInteractor {
// Keep track of the command we wish to run
let action = site.secured ? "unsecure" : "secure"
let command = "cd '\(site.absolutePath)' && sudo \(Paths.valet) \(action) && exit;"
// Use modernized version of command using domain name
// This will allow us to secure multiple domains that use the same path
var command = "sudo \(Paths.valet) \(action) '\(site.name)' && exit;"
// For Valet 2, use the old syntax; this has a known issue so Valet 3+ is preferred
if !Valet.enabled(feature: .isolatedSites) {
command = "cd '\(site.absolutePath)' && sudo \(Paths.valet) \(action) && exit;"
}
// Run the command
await Shell.quiet(command)