Skip to content

Replace Valet cert path with Vite env vars#56

Merged
munezaclovis merged 8 commits intomainfrom
feat/vite-tls-env-vars
Apr 5, 2026
Merged

Replace Valet cert path with Vite env vars#56
munezaclovis merged 8 commits intomainfrom
feat/vite-tls-env-vars

Conversation

@munezaclovis
Copy link
Copy Markdown
Contributor

Summary

  • Move TLS cert storage from ~/.config/valet/Certificates/ to ~/.pv/data/certs/
  • Write VITE_DEV_SERVER_KEY and VITE_DEV_SERVER_CERT to .env during pv link (new SetViteTLSStep)
  • Remove all Valet config directory code (EnsureValetConfig, RemoveConfig, config.json management)
  • Fixes --name flag mismatch: Vite plugin's basename(cwd) detection is bypassed entirely — env vars point directly to the correct cert

Why

The Vite plugin resolves hostnames from basename(cwd), not the link name. When pv link --name=custom is used, the old Valet auto-detection couldn't find certs. The plugin's second detection path (VITE_DEV_SERVER_* env vars) is explicit and immune to this mismatch.

Also: pv no longer pretends to be Valet by maintaining ~/.config/valet/.

Changes

  • internal/certs/valet.go — Rewritten: CertsDir(), CertPath(), KeyPath(), GenerateSiteTLS(), RemoveSiteTLS(), RemoveLinkedCerts()
  • internal/laravel/steps.go — New SetViteTLSStep automation step
  • internal/config/settings.go — New SetViteTLS automation gate
  • internal/automation/pipeline.go — New "set_vite_tls" gate case
  • cmd/link.goSetViteTLSStep added to pipeline
  • internal/automation/steps/generate_tls_cert.go — Removed EnsureValetConfig call
  • cmd/setup.go — Removed EnsureValetConfig call
  • cmd/uninstall.go — Removed RemoveConfig call

Test plan

  • New cert storage path tests (CertsDir, CertPath, KeyPath, RemoveSiteTLS, RemoveLinkedCerts)
  • SetViteTLSStep tests (ShouldRun + Run with .env verification)
  • Settings default and pipeline gate tests updated
  • Full test suite passes
  • Zero Valet references remaining in source
  • gofmt and go vet clean

Replace Valet cert path with VITE_DEV_SERVER_* env vars
and pv-native cert storage at ~/.pv/data/certs/.
6 tasks: rewrite cert storage, update callers, add SetViteTLSStep,
wire settings/pipeline, update tests, final verification.
Replace Valet-specific cert functions with pv-native storage.
Remove EnsureValetConfig, ValetConfigDir, ValetCertsDir,
RemoveConfig, and all config.json management.
EnsureValetConfig and RemoveConfig are gone. GenerateTLSCertStep
now calls GenerateSiteTLS directly. RemoveLinkedCerts still used
in uninstall (points to new cert dir).
Writes VITE_DEV_SERVER_KEY and VITE_DEV_SERVER_CERT to .env
pointing to pv's cert storage. Runs for Laravel projects with
.env files.
New automation gate 'set_vite_tls' defaults to on. Step runs
after SetAppURLStep in the link pipeline.
No Valet references remain — filename now reflects its purpose.
@munezaclovis munezaclovis merged commit db74790 into main Apr 5, 2026
1 check passed
@munezaclovis munezaclovis deleted the feat/vite-tls-env-vars branch April 5, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant