Skip to content

feat: Phase B — migrate sponsor + distribution routes to getConfig()#609

Merged
codercatdev merged 7 commits intodevfrom
feat/config-migrate-sponsor-distribute
Mar 5, 2026
Merged

feat: Phase B — migrate sponsor + distribution routes to getConfig()#609
codercatdev merged 7 commits intodevfrom
feat/config-migrate-sponsor-distribute

Conversation

@codercatdev
Copy link
Contributor

@codercatdev codercatdev commented Mar 5, 2026

Phase B: Migrate sponsor + distribution routes to getConfig()

Replaces hardcoded constants and process.env config values with getConfig() / getConfigValue() from the Sanity config singletons.

Changes (4 files)

File Config Values Migrated
app/api/cron/sponsor-outreach/route.ts cooldownDays, maxOutreachPerRun, rateCardTiers from sponsor_config
lib/sponsor/gemini-outreach.ts geminiModel from pipeline_config (was process.env.GEMINI_MODEL)
app/api/webhooks/sanity-distribute/route.ts resendFromEmail, notificationEmails from distribution_config
lib/resend-notify.ts Extended signature with optional fromEmail + notificationEmails params (backward compatible)

What stays as process.env

  • All API keys: GEMINI_API_KEY, RESEND_API_KEY
  • Auth secrets: CRON_SECRET, SANITY_WEBHOOK_SECRET
  • Build-time: NEXT_PUBLIC_URL

Transition safety

  • getConfigValue() used with fallback defaults — if Sanity singleton doesn't exist yet, routes still work
  • resend-notify.ts params are optional — existing callers without new params use sensible defaults
  • Rate card built dynamically from sponsorCfg.rateCardTiers with DEFAULT_RATE_CARD fallback

- sponsor-outreach: cooldownDays, maxOutreachPerRun from sponsor_config
- gemini-outreach: geminiModel from pipeline_config, rate card from caller
- sanity-distribute: pass distribution config to notifySubscribers
- resend-notify: accept fromEmail + notificationEmails params

Co-authored-by: content <content@miriad.systems>
@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:10am

Miriad and others added 4 commits March 5, 2026 06:02
Revert sponsor-outreach, sanity-distribute, resend-notify, gemini-outreach
back to dev state. These belong to @content's Phase B scope.
Co-authored-by: content <content@miriad.systems>
- sponsor-outreach: cooldownDays, maxOutreachPerRun, rateCardTiers from sponsor_config
- gemini-outreach: geminiModel from pipeline_config, renamed RATE_CARD to DEFAULT_RATE_CARD
- resend-notify: accept optional fromEmail + notificationEmails params (backward compatible)

Keeps all API keys and auth secrets as process.env.
- Fetch distribution_config singleton at start of runDistribution()
- Pass resendFromEmail + notificationEmails to notifySubscribers()
@codercatdev codercatdev changed the title feat: Phase B — migrate sponsor + distribution + ingest routes to getConfig() feat: Phase B — migrate sponsor + distribution routes to getConfig() Mar 5, 2026
@codercatdev codercatdev merged commit d5d334b into dev Mar 5, 2026
2 of 3 checks passed
@codercatdev codercatdev deleted the feat/config-migrate-sponsor-distribute branch March 5, 2026 06:24
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