File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,11 +135,19 @@ Copy `.env.example` to `.env` and provide:
135135- ` GITHUB_CLIENT_ID ` / ` GITHUB_CLIENT_SECRET ` - OAuth App credentials
136136- ` GITHUB_TOKEN ` - Personal access token with ` read:user ` and ` public_repo ` scopes
137137- ` NEXTAUTH_SECRET ` - Generate with ` openssl rand -base64 32 `
138- - ` NEXTAUTH_URL ` - http://localhost:3000
138+ - ` NEXTAUTH_URL ` - http://localhost:3000 (for development) or your production URL (e.g., https://yourdomain.com )
139139
140140** OpenAI (optional - for AI image generation):**
141141- ` OPENAI_API_KEY ` - OpenAI API key
142142
143+ ** Email Notifications (required for access request emails):**
144+ - ` RESEND_API_KEY ` - Resend API key for sending emails
145+ - ` RESEND_FROM_DOMAIN ` - Domain for sending emails (e.g., yourdomain.com)
146+ - ` ADMIN_EMAIL ` - Email address to receive access request notifications
147+
148+ ** Redis (required for access control):**
149+ - ` REDIS_URL ` - Redis connection URL (e.g., redis://localhost:6379)
150+
143151## Key Features
144152
145153### Unified Foundation + Store
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ Copy `.env.example` to `.env` and provide:
4949- ` GITHUB_CLIENT_ID ` / ` GITHUB_CLIENT_SECRET ` - OAuth App credentials
5050- ` GITHUB_TOKEN ` - Personal access token with ` read:user ` and ` public_repo ` scopes
5151- ` NEXTAUTH_SECRET ` - Generate with ` openssl rand -base64 32 `
52- - ` NEXTAUTH_URL ` - http://localhost:3000
52+ - ` NEXTAUTH_URL ` - http://localhost:3000 (for development) or your production URL (e.g., https://yourdomain.com )
5353
5454** OpenAI (optional - for AI image generation):**
5555- ` OPENAI_API_KEY ` - OpenAI API key
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ GITHUB_CLIENT_ID=xxxxx
6565GITHUB_CLIENT_SECRET=xxxxx
6666GITHUB_TOKEN=ghp_xxxxx
6767NEXTAUTH_SECRET=xxxxx
68- NEXTAUTH_URL=http://localhost:3000
68+ NEXTAUTH_URL=http://localhost:3000 # Use production URL (e.g., https://yourdomain.com) when deployed
6969```
7070
7171### 2. API Tokens
Original file line number Diff line number Diff line change @@ -75,7 +75,9 @@ export async function POST(request: NextRequest) {
7575 const approveToken = AccessRequestsService . generateActionToken ( accessRequest . id , 'approve' ) ;
7676 const denyToken = AccessRequestsService . generateActionToken ( accessRequest . id , 'deny' ) ;
7777
78- const baseUrl = process . env . NEXTAUTH_URL || 'http://localhost:3000' ;
78+ // Get base URL from request or environment variable
79+ const requestUrl = new URL ( request . url ) ;
80+ const baseUrl = process . env . NEXTAUTH_URL || `${ requestUrl . protocol } //${ requestUrl . host } ` ;
7981 const approveUrl = `${ baseUrl } /api/admin/request-action?token=${ approveToken } ` ;
8082 const denyUrl = `${ baseUrl } /api/admin/request-action?token=${ denyToken } ` ;
8183 const reviewUrl = `${ baseUrl } /admin/requests?id=${ accessRequest . id } ` ;
Original file line number Diff line number Diff line change @@ -195,7 +195,12 @@ export class AccessRequestsService {
195195 }
196196
197197 const fromDomain = process . env . RESEND_FROM_DOMAIN || 'yourdomain.com' ;
198- const baseUrl = process . env . NEXTAUTH_URL || 'http://localhost:3000' ;
198+ const baseUrl = process . env . NEXTAUTH_URL ;
199+
200+ if ( ! baseUrl ) {
201+ console . error ( '❌ NEXTAUTH_URL not configured - email will not include links' ) ;
202+ // Still send email, but without the link
203+ }
199204
200205 console . log ( ` From: noreply@${ fromDomain } ` ) ;
201206 console . log ( ` To: ${ email } ` ) ;
@@ -212,9 +217,9 @@ export class AccessRequestsService {
212217 <h1 style="color: #10b981; font-size: 32px;">🎉 Welcome!</h1>
213218 <p style="font-size: 18px; color: #fff;">Your access request has been approved.</p>
214219 <p style="color: #aaa; margin: 20px 0;">You can now sign in and access the React Foundation.</p>
215- <a href="${ baseUrl } " style="display: inline-block; margin-top: 20px; padding: 14px 32px; background: #06b6d4; color: #000; text-decoration: none; border-radius: 8px; font-weight: bold;">
220+ ${ baseUrl ? ` <a href="${ baseUrl } " style="display: inline-block; margin-top: 20px; padding: 14px 32px; background: #06b6d4; color: #000; text-decoration: none; border-radius: 8px; font-weight: bold;">
216221 Sign In Now
217- </a>
222+ </a>` : '<p style="color: #666; margin-top: 20px;">Please visit the React Foundation to sign in.</p>' }
218223 </div>
219224 </body>
220225 </html>
You can’t perform that action at this time.
0 commit comments