Skip to content

release: Config-to-Sanity Phase A+B — 6 singletons + all routes migrated#614

Merged
codercatdev merged 3 commits intomainfrom
dev
Mar 5, 2026
Merged

release: Config-to-Sanity Phase A+B — 6 singletons + all routes migrated#614
codercatdev merged 3 commits intomainfrom
dev

Conversation

@codercatdev
Copy link
Contributor

Config-to-Sanity: Phase A + B

Moves all tweakable pipeline config from environment variables to Sanity singleton documents. Alex can now edit Gemini model, voice ID, quality thresholds, stuck timeouts, RSS feeds, rate card tiers, email templates, and more — directly from Sanity Studio, no redeployment needed.

Phase A — Foundation (PR #607)

  • 6 Sanity singleton schemas: pipelineConfig, remotionConfig, contentConfig, sponsorConfig, distributionConfig, gcsConfig
  • All registered in sanity.config.ts + singletonPlugin
  • lib/config.ts rewritten: getConfig() / getConfigValue() with 5-min stale-while-revalidate cache
  • lib/types/config.ts updated to camelCase with Sanity _id/_type/_updatedAt
  • Removed Supabase config SQL migration + invalidate endpoint

Phase B — Route Migration (PRs #609, #612, #613)

  • Cron routes (ingest, check-research): enableNotebookLmResearch, qualityThreshold, systemInstruction, stuckTimeoutMinutes
  • Video services (remotion.ts, elevenlabs.ts, gcs.ts): awsRegion, serveUrl, functionName, voiceId, bucketName, projectId
  • Sponsor + distribution (sponsor-outreach, sanity-distribute, resend-notify, gemini-outreach): cooldownDays, maxOutreachPerRun, rateCardTiers, resendFromEmail, notificationEmails, geminiModel

Key Design Decisions

  • Secrets stay as process.env — API keys, credentials, tokens are NOT in Sanity
  • All values have env var fallbacks via getConfigValue() — backward compatible if singletons aren't created yet
  • initialValue defaults on all schema fields — singletons create with sensible values

Build Status

  • TypeScript compiles clean (tsc --noEmit — only pre-existing sanity-revalidate error, same on main)
  • No new dependencies added

…609)

Migrates sponsor-outreach cron and distribution webhook to Sanity config singletons. cooldownDays, maxOutreachPerRun, rateCardTiers from sponsor_config. resendFromEmail, notificationEmails from distribution_config. geminiModel from pipeline_config. All use getConfig()/getConfigValue() with backward-compatible fallbacks. Secrets stay as process.env.
Migrates video service config from process.env to Sanity config singletons. remotion.ts: awsRegion, serveUrl, functionName from remotion_config. elevenlabs.ts: voiceId from pipeline_config. gcs.ts: bucketName, projectId from gcs_config. All use getConfigValue() with env var fallbacks. Secrets (AWS keys, API keys, GCS credentials) stay as process.env. Renamed RemotionConfig→RemotionLambdaConfig and getConfig→getElevenLabsConfig to avoid collisions with config module.
Migrates cron routes to Sanity config singletons. ingest/route.ts: enableNotebookLmResearch, qualityThreshold, systemInstruction from pipeline_config/content_config. check-research/route.ts: stuckTimeoutMinutes (with proportional sub-thresholds), qualityThreshold, systemInstruction. All use getConfigValue() with hardcoded fallbacks for backward compatibility. Also fixes pre-existing REDACTED SECRET corruption in FALLBACK_TRENDS. Secrets/API keys stay as process.env.
@vercel
Copy link

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
codingcat-dev Ignored Ignored Mar 5, 2026 6:32am

@codercatdev codercatdev merged commit d1e0c58 into main Mar 5, 2026
1 of 3 checks passed
codercatdev added a commit that referenced this pull request Mar 5, 2026
Merge pull request #614 from CodingCatDev/dev
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