Skip to content

fix: remove process.env fallbacks — Sanity is single source of truth#618

Merged
codercatdev merged 3 commits intodevfrom
fix/remove-env-fallbacks
Mar 5, 2026
Merged

fix: remove process.env fallbacks — Sanity is single source of truth#618
codercatdev merged 3 commits intodevfrom
fix/remove-env-fallbacks

Conversation

@codercatdev
Copy link
Contributor

Summary

Removes redundant process.env.X fallbacks from getConfigValue() calls across the codebase. Sanity config singletons are now the single source of truth for all runtime configuration — env vars are only used for secrets/credentials (API keys, private keys, etc.).

Also adds clear description fields to all 6 Sanity config schemas so editors understand what each value does.

Task 1: Remove env var fallbacks (9 env vars across 6 files)

File Env Var Removed New Call
lib/services/elevenlabs.ts ELEVENLABS_VOICE_ID getConfigValue("pipeline_config", "elevenLabsVoiceId", "pNInz6obpgDQGcFmaJgB")
lib/services/remotion.ts REMOTION_AWS_REGION getConfigValue("remotion_config", "awsRegion", "us-east-1")
lib/services/remotion.ts REMOTION_SERVE_URL getConfigValue("remotion_config", "serveUrl", undefined)
lib/services/remotion.ts REMOTION_FUNCTION_NAME getConfigValue("remotion_config", "functionName", "remotion-render-4-0-431-mem2048mb-disk2048mb-240sec")
lib/services/gcs.ts GCS_BUCKET getConfigValue("gcs_config", "bucketName", "codingcatdev-content-engine")
lib/services/gcs.ts GCS_PROJECT_ID getConfigValue("gcs_config", "projectId", "codingcatdev")
lib/gemini.ts GEMINI_MODEL getConfigValue("pipeline_config", "geminiModel", "gemini-2.0-flash")
lib/sponsor/gemini-intent.ts GEMINI_MODEL getConfigValue("pipeline_config", "geminiModel", "gemini-2.0-flash")
lib/youtube-upload.ts YOUTUBE_UPLOAD_VISIBILITY getConfigValue("pipeline_config", "youtubeUploadVisibility", "private")

Notable changes:

  • lib/gemini.ts: generateWithGemini() was already async — moved process.env.GEMINI_MODEL inside the function body and replaced with getConfigValue() call
  • lib/youtube-upload.ts: getDefaultPrivacyStatus() converted from sync to async, callers updated with await
  • lib/services/remotion.ts: Updated error messages to reference Sanity config instead of env vars
  • lib/services/remotion-deploy.ts: NOT touched — deploy helpers use env vars directly (not getConfigValue)

Task 2: Sanity schema descriptions (6 files, 30+ fields)

Added description fields to every config field across all 6 singleton schemas:

  • pipelineConfig.ts — 8 fields
  • remotionConfig.ts — 6 fields
  • contentConfig.ts — 6 fields
  • sponsorConfig.ts — 4 fields
  • distributionConfig.ts — 4 fields
  • gcsConfig.ts — 2 fields

What stays as env vars (secrets only)

These are NOT managed in Sanity (they're secrets):

  • ELEVENLABS_API_KEY, GEMINI_API_KEY
  • AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
  • GCS_CLIENT_EMAIL, GCS_PRIVATE_KEY
  • YOUTUBE_CLIENT_ID, YOUTUBE_CLIENT_SECRET, YOUTUBE_REFRESH_TOKEN
  • CRON_SECRET, NOTEBOOKLM_AUTH_JSON

Testing

  • Verify Sanity Studio loads config schemas with descriptions
  • Verify pipeline runs use Sanity config values (not env vars)
  • Verify error messages reference correct config sources

…Sanity schema descriptions

Task 1: Remove redundant env var fallbacks — Sanity is now the single source of truth
- lib/services/elevenlabs.ts: remove process.env.ELEVENLABS_VOICE_ID fallback
- lib/services/remotion.ts: remove REMOTION_AWS_REGION, REMOTION_SERVE_URL, REMOTION_FUNCTION_NAME fallbacks
- lib/services/gcs.ts: remove GCS_BUCKET, GCS_PROJECT_ID fallbacks
- lib/gemini.ts: replace process.env.GEMINI_MODEL with getConfigValue (make generateWithGemini async-aware)
- lib/sponsor/gemini-intent.ts: replace process.env.GEMINI_MODEL with getConfigValue
- lib/youtube-upload.ts: replace process.env.YOUTUBE_UPLOAD_VISIBILITY with getConfigValue

Task 2: Add clear description fields to all Sanity config schemas
- pipelineConfig, remotionConfig, contentConfig, sponsorConfig, distributionConfig, gcsConfig
@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 0:37am

@codercatdev codercatdev merged commit 33fb349 into dev Mar 5, 2026
2 of 3 checks passed
@codercatdev codercatdev deleted the fix/remove-env-fallbacks branch March 5, 2026 13:19
codercatdev added a commit that referenced this pull request Mar 5, 2026
Release: ingest dedup + env var cleanup
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