Skip to content

Commit b5659ef

Browse files
devakoneclaude
andcommitted
fix(scripts): load .env before .env.local in backfill script
Production credentials in .env should take priority, with .env.local as fallback for local development overrides. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0c8549d commit b5659ef

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

scripts/backfill-community-snapshots.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* node scripts/backfill-community-snapshots.mjs
66
*
77
* Requires NEXT_PUBLIC_SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY in env
8-
* (loaded from apps/web/.env.local if present).
8+
* (loaded from apps/web/.env, with fallback to apps/web/.env.local).
99
*/
1010

1111
import fs from "node:fs";
@@ -17,7 +17,7 @@ const ELIGIBLE_MIN_COMMITS = 80;
1717
const ANALYZER_VERSION = "backfill-v1";
1818

1919
// ---------------------------------------------------------------------------
20-
// Load env from .env.local (same pattern as scripts/supabase.mjs)
20+
// Load env: .env first (production), then .env.local as fallback
2121
// ---------------------------------------------------------------------------
2222
function loadDotEnvFile(filePath) {
2323
if (!fs.existsSync(filePath)) return;
@@ -42,8 +42,8 @@ function loadDotEnvFile(filePath) {
4242
}
4343

4444
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
45-
loadDotEnvFile(path.join(repoRoot, "apps/web/.env.local"));
4645
loadDotEnvFile(path.join(repoRoot, "apps/web/.env"));
46+
loadDotEnvFile(path.join(repoRoot, "apps/web/.env.local"));
4747

4848
// ---------------------------------------------------------------------------
4949
// Main

0 commit comments

Comments
 (0)