chore: migrate env management to varlock + infisical#251
Merged
DaveHudson merged 4 commits intomainfrom May 8, 2026
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.env.examplefiles with.env.schemafiles forapps/web,apps/desktop, and.sandcastle; values now resolve at runtime from Infisical via varlocknext.config.tsandelectron.vite.config.ts; drop the manualprocess.env.SENTRY_DSNdefinevarlock scantobun run ciand addglobalEnv/globalDependenciesentries toturbo.jsonso cache keys track env declarationsdocs/codex-provider-support-plan.md,docs/sandcastle-droid-style-missions.md) and incidental config tweaks that were sitting in the working treeTest plan
bun run cipasses locallybun run devboots web + desktop with env values pulled from Infisical