forked from Kenfiz123/AWS_WS_FE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.env.local.example
More file actions
111 lines (100 loc) · 4.7 KB
/
.env.local.example
File metadata and controls
111 lines (100 loc) · 4.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# =============================================================================
# FRONTEND ENVIRONMENT CONFIGURATION
# =============================================================================
# Copy this file to .env.local and configure for your environment
# =============================================================================
# AUTHENTICATION MODE
# =============================================================================
# Choose ONE of three modes:
# MODE 1: Basic Auth (Direct API testing, no Cognito)
# - Set NEXT_PUBLIC_USE_COGNITO=false
# - All API requests use Basic Auth header
# - Backend role controlled by LOCAL_BASIC_AUTH_ROLE env variable
NEXT_PUBLIC_USE_COGNITO=false
NEXT_PUBLIC_USE_MOCK_AUTH=false
# MODE 2: Mock Cognito (localStorage-based auth for development)
# - Set NEXT_PUBLIC_USE_COGNITO=true and NEXT_PUBLIC_USE_MOCK_AUTH=true
# - No AWS credentials needed
# - Pre-seeded test users available
# NEXT_PUBLIC_USE_COGNITO=true
# NEXT_PUBLIC_USE_MOCK_AUTH=true
# MODE 3: Real AWS Cognito (Production)
# - Set NEXT_PUBLIC_USE_COGNITO=true and NEXT_PUBLIC_USE_MOCK_AUTH=false
# - Requires AWS Cognito configuration below
# NEXT_PUBLIC_USE_COGNITO=true
# NEXT_PUBLIC_USE_MOCK_AUTH=false
# =============================================================================
# BASIC AUTH CREDENTIALS (MODE 1 only)
# =============================================================================
# Used when NEXT_PUBLIC_USE_COGNITO=false
NEXT_PUBLIC_BASIC_USER=local-admin
NEXT_PUBLIC_BASIC_PASS=local-password
# =============================================================================
# MOCK AUTHENTICATION (MODE 2 only)
# =============================================================================
# Pre-seeded test users (all with password: password123):
# - client@test.com (CLIENT_USER)
# - gym@test.com (GYM_STAFF)
# - trainer@test.com (PT_USER)
# - admin@test.com (ADMIN)
# =============================================================================
# REAL AWS COGNITO (MODE 3 only)
# =============================================================================
# Required when using real Cognito authentication
# NEXT_PUBLIC_COGNITO_USER_POOL_ID=us-east-1_XXXXXXXXX
# NEXT_PUBLIC_COGNITO_CLIENT_ID=xxxxxxxxxxxxxxxxxxxxxxxxxx
# NEXT_PUBLIC_COGNITO_REGION=us-east-1
# =============================================================================
# API CONFIGURATION
# =============================================================================
# Backend API base URL
NEXT_PUBLIC_API_BASE_URL=http://localhost:8080/api/v1
# =============================================================================
# AWS S3 CONFIGURATION (for media uploads)
# =============================================================================
# NEXT_PUBLIC_AWS_REGION=us-east-1
# NEXT_PUBLIC_S3_BUCKET=your-bucket-name
# AWS_ACCESS_KEY_ID=your-access-key
# AWS_SECRET_ACCESS_KEY=your-secret-key
# =============================================================================
# BACKEND CONFIGURATION NOTES
# =============================================================================
# Make sure your backend is configured correctly:
#
# MODE 1 - Basic Auth (Direct API testing):
# - Backend: Set AWS_ENABLED=false
# - Backend: Enable Basic Auth (app.auth.basic.enabled=true)
# - Backend: Set LOCAL_BASIC_AUTH_ROLE=ADMIN|GYM_STAFF|PT_USER|CLIENT_USER
# - Backend: Use credentials local-admin:local-password
# - Frontend: No login UI needed, direct API access
#
# MODE 2 - Mock Cognito (Development):
# - Backend: Set AWS_ENABLED=false
# - Backend: Enable Basic Auth (app.auth.basic.enabled=true)
# - Backend: Use credentials local-admin:local-password
# - Frontend: Login UI works, tokens stored in localStorage
#
# MODE 3 - Real Cognito (Production):
# - Backend: Set AWS_ENABLED=true
# - Backend: Configure COGNITO_USER_POOL_ID, COGNITO_CLIENT_ID, COGNITO_JWKS_URL
# - Backend: Disable Basic Auth (app.auth.basic.enabled=false)
# - Frontend: Real AWS Cognito authentication
# =============================================================================
# TESTING CHECKLIST
# =============================================================================
# MODE 1 (Basic Auth):
# 1. Set NEXT_PUBLIC_USE_COGNITO=false
# 2. Set backend LOCAL_BASIC_AUTH_ROLE to desired role
# 3. Restart backend
# 4. Test API endpoints directly (no login needed)
# 5. Check for 401 (missing header) or 403 (wrong role)
#
# MODE 2 (Mock Cognito):
# 1. Set NEXT_PUBLIC_USE_COGNITO=true and NEXT_PUBLIC_USE_MOCK_AUTH=true
# 2. Use pre-seeded test users to login
# 3. Test full auth flow with UI
#
# MODE 3 (Real Cognito):
# 1. Set NEXT_PUBLIC_USE_COGNITO=true and NEXT_PUBLIC_USE_MOCK_AUTH=false
# 2. Configure AWS Cognito credentials
# 3. Test with real AWS Cognito users