mirror of
https://github.com/tiennm99/store-scraper-bot.git
synced 2026-10-15 10:15:38 +00:00
feat: accept KV_REST_API_* env vars as Upstash fallback
Vercel Marketplace Upstash integration injects KV_REST_API_URL and KV_REST_API_TOKEN — different names from vanilla Upstash signup (UPSTASH_REDIS_REST_URL / UPSTASH_REDIS_REST_TOKEN). Adapter and migration script now accept either form, so the operator doesn't have to duplicate values when sharing an Upstash DB provisioned via the Vercel integration. UPSTASH_* takes precedence when both are set.
This commit is contained in:
1 parent
a5af074062
commit
cad84e21a4
4 files changed
+24
-12
No files matched your search
@@ -45,12 +45,14 @@ async function main() {
|
||||
const mongoUri = process.env.MONGODB_URI;
|
||||
if (!mongoUri) exitWith('MONGODB_URI not set; check .env.deploy');
|
||||
|
||||
const upstashUrl = process.env.UPSTASH_REDIS_REST_URL;
|
||||
const upstashToken = process.env.UPSTASH_REDIS_REST_TOKEN;
|
||||
// Accept either Upstash naming convention (vanilla signup) or Vercel
|
||||
// Marketplace integration names — same as the runtime adapter.
|
||||
const upstashUrl = process.env.UPSTASH_REDIS_REST_URL ?? process.env.KV_REST_API_URL;
|
||||
const upstashToken = process.env.UPSTASH_REDIS_REST_TOKEN ?? process.env.KV_REST_API_TOKEN;
|
||||
const dryRun = process.argv.includes('--dry-run');
|
||||
if (!dryRun) {
|
||||
if (!upstashUrl) exitWith('UPSTASH_REDIS_REST_URL not set; check .env.deploy');
|
||||
if (!upstashToken) exitWith('UPSTASH_REDIS_REST_TOKEN not set; check .env.deploy');
|
||||
if (!upstashUrl) exitWith('UPSTASH_REDIS_REST_URL (or KV_REST_API_URL) not set; check .env.deploy');
|
||||
if (!upstashToken) exitWith('UPSTASH_REDIS_REST_TOKEN (or KV_REST_API_TOKEN) not set; check .env.deploy');
|
||||
}
|
||||
|
||||
const includeCache = process.argv.includes('--include-cache');
|
||||
|
||||
Reference in new issue
Block a user