feat: Convex integration — sync env vars to Convex deployments#420
feat: Convex integration — sync env vars to Convex deployments#420sergical wants to merge 1 commit intodmno-dev:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 16bdcc9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…ts (dmno-dev#355) New @varlock/convex-integration package that syncs varlock-resolved environment variables to Convex deployments via @syncTarget(convex) decorator. Core changes: - Add syncTargets field to SerializedEnvGraph for @syncTarget() decorators - Guard Buffer access in runtime/env.ts for serverless environments
743416d to
16bdcc9
Compare
|
Thanks for this @sergical ! We probably want to think through sync as a first class concept since people are already doing this via |
|
@philmillman yeah we chatted through it a bit last night. the reason i didn't go with a plugin here is because it is setup as a pull, where this with the push and sync felt a bit more integration-y but definitely hear you on the fact that "push" needs to be thought of a bit more before making a decision on the right approach, this was mostly a POC also the idea of will sync up again and proceed as best fitted here |
Summary
Adds
@varlock/convex-integration, a new integration package that syncs varlock-resolved environment variables to Convex deployments.What this enables
Users can tag specific env vars in their
.env.schemawith@syncTarget(convex)to selectively push them to a Convex backend — keeping auth-only secrets (like 1Password tokens) out of the sync.User experience
1. Install and configure — add the plugin to your
.env.schema:2. Preview what will be synced:
3. Push to Convex:
4. In CI/deploy pipelines:
npx convex deploy --cmd "varlock-convex-sync"What gets pushed
npx convex env set --from-file(forprocess.env.KEYaccess)__VARLOCK_ENVblob containing a minimal graph (forimport { ENV } from 'varlock/env'support in Convex functions)@syncTarget(convex)are excluded from bothCLI options
--deploy-key <key>CONVEX_DEPLOY_KEYenv var)--env <name>production)--path <path>.env.schemaor project directory--prod--prodflag to Convex CLI--no-blob__VARLOCK_ENVblob--no-individual--dry-runChanges
New package:
@varlock/convex-integrationsrc/plugin.ts) — registers@syncTargetitem decorator andconvexDeployKeydata typesrc/index.ts) — resolves env graph, filters by@syncTarget(convex), builds minimal blob, pushes via Convex CLIsrc/cli.ts) —varlock-convex-syncbinary with dry-run,--prod,--no-blobsupportsyncTargetspopulation, sensitivity flagsCore changes (
varlock)env-graph.ts— addsyncTargets?: Array<string>toSerializedEnvGraphconfig items, populated from@syncTarget()function-call decorators during serializationruntime/env.ts— guardBufferaccess withtypeof Buffer !== 'undefined'for serverless runtimes (Convex) that lack a globalBufferTest results
packages/integrations/convex/test/sync.test.ts)smoke-tests/tests/convex.test.ts)