Skip to content

Commit 1b30ad0

Browse files
committed
fix: configure preview environment to use dev data for bio compatibility
- Change preview deployments to use DEV_ prefixed collections - This ensures bio and user data is available in preview deployments - Preview environments now use dev data for testing instead of production data - Update documentation and validation logic to reflect this change
1 parent 5365fe3 commit 1b30ad0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

app/utils/environmentConfig.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Environment Configuration Requirements:
99
* - Local development: use dev data with DEV_ prefixed collections
1010
* - Vercel dev deployment: use dev data with DEV_ prefixed collections
11-
* - Vercel preview deployment: use actual production data (base collection names)
11+
* - Vercel preview deployment: use dev data for testing (DEV_ prefixed collections)
1212
* - Vercel production deployment: use actual production data (base collection names)
1313
*
1414
* This architecture enables seamless migration to separate Firebase projects
@@ -77,7 +77,7 @@ export const getEnvironmentPrefix = (): string => {
7777
case 'production':
7878
return ''; // No prefix for production (base collection names)
7979
case 'preview':
80-
return ''; // Preview uses actual production data (base collection names)
80+
return 'DEV_'; // Preview uses dev data for testing (DEV_ prefix)
8181
case 'development':
8282
return 'DEV_'; // Development uses dev data with DEV_ prefix
8383
default:
@@ -95,7 +95,7 @@ export const getSubscriptionEnvironmentPrefix = (): string => {
9595
case 'production':
9696
return ''; // No prefix for production (base collection names)
9797
case 'preview':
98-
return ''; // Preview uses actual production data (base collection names)
98+
return 'DEV_'; // Preview uses dev data for testing (DEV_ prefix)
9999
case 'development':
100100
return 'DEV_'; // Development uses dev data with DEV_ prefix
101101
default:
@@ -115,7 +115,7 @@ export const getSubscriptionEnvironmentPrefix = (): string => {
115115
*
116116
* Current behavior (single Firebase project):
117117
* - Production: 'users' -> 'users' (base collection names)
118-
* - Preview: 'users' -> 'users' (actual production data)
118+
* - Preview: 'users' -> 'DEV_users' (dev data for testing with DEV_ prefix)
119119
* - Development: 'users' -> 'DEV_users' (isolated dev data with DEV_ prefix)
120120
*
121121
* Future behavior (separate Firebase projects):
@@ -138,7 +138,7 @@ export const getCollectionName = (baseName: string): string => {
138138
*
139139
* Current behavior (single Firebase project):
140140
* - Production: ('users', 'userId', 'subscriptions') -> 'users/userId/subscriptions'
141-
* - Preview: ('users', 'userId', 'subscriptions') -> 'users/userId/subscriptions'
141+
* - Preview: ('users', 'userId', 'subscriptions') -> 'DEV_users/userId/DEV_subscriptions'
142142
* - Development: ('users', 'userId', 'subscriptions') -> 'DEV_users/userId/DEV_subscriptions'
143143
*/
144144
export const getSubCollectionPath = (
@@ -235,9 +235,9 @@ export const validateEnvironmentConfig = (): boolean => {
235235
break;
236236

237237
case 'preview':
238-
if (prefix !== '') {
239-
console.error('[Environment Config] ERROR: Preview environment should use base collection names!');
240-
console.error(`[Environment Config] Expected: '', Got: '${prefix}'`);
238+
if (prefix !== 'DEV_') {
239+
console.error('[Environment Config] ERROR: Preview environment should use DEV_ prefix for testing!');
240+
console.error(`[Environment Config] Expected: 'DEV_', Got: '${prefix}'`);
241241
return false;
242242
}
243243
break;

0 commit comments

Comments
 (0)