-
Notifications
You must be signed in to change notification settings - Fork 8
Production-ready Docker Compose setup: env handling, volumes, and documentation #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| JWT_SECRET="YOUR_SECRET" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,7 +73,21 @@ async me(@Req() req: Request) { | |
| }); | ||
| } | ||
|
|
||
| return this.authService.sendMagicLink(email); | ||
| // Generate the magic link (modify sendMagicLink to return the link) | ||
| // const magicLink = await this.authService.sendMagicLink(email); | ||
| const mockMode = process.env.MOCK_EMAIL_ENABLED === 'true'; | ||
| const magicLink = await this.authService.sendMagicLink(email, mockMode); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sendMagicLink(email, mockMode) only accepts email as an argument You did not implement the sendmagicLink funtion |
||
|
|
||
| // Check the environment variable | ||
| if (process.env.MOCK_EMAIL_ENABLED === 'true') { | ||
| console.log(`\n=== MOCK LOGIN LINK ===\n${magicLink}\n======================\n`); | ||
| return { message: 'Mock login link printed to console.' }; | ||
| } | ||
|
|
||
| // Otherwise, proceed as normal (send email) | ||
| return { message: 'Login link sent to email.' }; | ||
|
|
||
| // return this.authService.sendMagicLink(email); | ||
| } | ||
|
|
||
| @Get('verify') | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ node_modules | |
| dist | ||
| dist-ssr | ||
| *.local | ||
| .env | ||
|
|
||
| # Editor directories and files | ||
| .vscode/* | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| VITE_API_URL="http://localhost:3000" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need only a single .env file in the root, both for the frontend and the backend. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,12 +5,22 @@ services: | |
| dockerfile: Dockerfile.backend | ||
| ports: | ||
| - "3000:3000" | ||
| environment: | ||
| - JWT_SECRET=${JWT_SECRET} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the future, we will add more environment variables, so we will need to use the .env file. |
||
| - BACKEND_PORT=3000 | ||
| volumes: | ||
| - sqlite-data:/app/apps/backend/prisma | ||
|
|
||
| frontend: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile.frontend | ||
| ports: | ||
| - "5173:80" | ||
| environment: | ||
| - VITE_API_URL=${VITE_API_URL} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the future, we will add more environment variables, so we will need to use the .env file to pass the values |
||
| depends_on: | ||
| - backend | ||
|
|
||
| volumes: | ||
| sqlite-data: | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need only a single .env file in the root, both for the frontend and the backend.