Skip to content

chore: migrate env management to varlock + infisical#251

Merged
DaveHudson merged 4 commits intomainfrom
chore/varlock-env-migration
May 8, 2026
Merged

chore: migrate env management to varlock + infisical#251
DaveHudson merged 4 commits intomainfrom
chore/varlock-env-migration

Conversation

@DaveHudson
Copy link
Copy Markdown
Collaborator

Summary

  • Replace .env.example files with .env.schema files for apps/web, apps/desktop, and .sandcastle; values now resolve at runtime from Infisical via varlock
  • Wire varlock plugins into next.config.ts and electron.vite.config.ts; drop the manual process.env.SENTRY_DSN define
  • Add varlock scan to bun run ci and add globalEnv / globalDependencies entries to turbo.json so cache keys track env declarations
  • Sweeps in two unrelated planning docs (docs/codex-provider-support-plan.md, docs/sandcastle-droid-style-missions.md) and incidental config tweaks that were sitting in the working tree

Test plan

  • bun run ci passes locally
  • bun run dev boots web + desktop with env values pulled from Infisical
  • Sentry DSN still reaches the desktop main process at runtime
  • CI green on the branch

DaveHudson added 4 commits May 8, 2026 13:23
Replace .env.example files with .env.schema files for apps/web,
apps/desktop, and .sandcastle. Wire varlock plugins into Next.js
and electron-vite configs. Add varlock scan to CI and globalEnv
entries to turbo.json so cache keys track env declarations.

Also includes unrelated planning docs and incidental config tweaks
swept up in the working tree.
env.d.ts is gitignored, so CI checks out a tree where TypedEnvSchema
has no fields, breaking apps/desktop's typecheck on ENV.SENTRY_DSN.
Add a typegen step (varlock typegen) to apps/desktop's typecheck
script so the declarations are produced from the committed .env.schema
before tsc runs.
…sical

CI builds were failing because the desktop schema requires INFISICAL_CLIENT_ID/
SECRET to resolve secrets from Infisical, but no credentials were provided in
the workflow. Wire the official varlock-action into ci.yml (quality, e2e,
e2e-electron) and release.yml so each job pulls the right Infisical
environment: staging for PR CI, prod for tagged releases, dev locally.

Switch the @initInfisical environment to $INFISICAL_ENV (with a default of
"dev" declared as a schema item) so the same schema works across all three
contexts without per-env schema files.
…oots

The Electron main bundle was calling initVarlockEnv() at startup, which
expects either varlock CLI to wrap the process (init-only mode) or values
already injected. Neither is true for a packaged app — Playwright launches
electron directly, and end users won't have varlock on PATH.

Switch the vite plugin to ssrInjectMode: 'resolved-env' so build-time env
values are inlined into all three bundles (main, preload, renderer). The
build still resolves env via process.env (varlock action in CI, or shell
exports locally), but the resulting binary needs no varlock at runtime.
@DaveHudson DaveHudson merged commit c766593 into main May 8, 2026
3 checks passed
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