diff --git a/README.md b/README.md index 2218a0a..8d80e9c 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,16 @@ docker compose -p wapydev-dev -f docker-compose-dev.yml up -d `SUBSCRIPTION_JWT_SECRET`: The secret key for the subscription signing. When you run the `setup.sh` script, it will generate a random secret for you. +### Building Docker Image + +If you want to build the Docker image locally, you can run the following command: + +``` +docker build -t wapy.dev -f Dockerfile . +``` + +Don't forget to update the `docker-compose.yml` file to use the local image. + ### Database Backup and Restore You can backup the database by running the `backup.sh` script. diff --git a/src/components/config.js b/src/components/config.js index 345b6a5..cca1c37 100644 --- a/src/components/config.js +++ b/src/components/config.js @@ -2,7 +2,7 @@ export const siteConfig = { name: 'Wapy.dev', description: 'Subscription and Expense Tracker', keywords: 'subscription, expense, tracker, wapy, meceware', - url: process.env.SITE_URL, + url: process.env.SITE_URL || 'http://localhost:3000', links: { github: 'https://github.com/meceware/wapy.dev', }, @@ -10,6 +10,6 @@ export const siteConfig = { name: 'meceware', url: 'https://www.meceware.com/', }, - from: 'Wapy.dev - Subscription Manager', + from: 'Wapy.dev Subscription Manager', subscriptionReminderFrom: `Wapy.dev Subscription Reminder <${process.env.RESEND_FROM}>`, }; diff --git a/src/lib/auth.js b/src/lib/auth.js index cbcfc39..5f9f94f 100644 --- a/src/lib/auth.js +++ b/src/lib/auth.js @@ -7,9 +7,9 @@ import { PrismaAdapter } from '@auth/prisma-adapter'; import { prisma } from '@/lib/prisma'; import { siteConfig } from '@/components/config'; -const authURL = new URL(`${process.env.SITE_URL}/api/auth`); -const cookiePrefix = authURL.protocol === 'https:' ? '__Secure-' : ''; -const authDomain = authURL.hostname === 'localhost' ? authURL.hostname : `.${authURL.hostname.split('.').slice(-2).join('.')}`; +const authURL = new URL(`${siteConfig.url}/api/auth`); +const cookiePrefix = authURL?.protocol === 'https:' ? '__Secure-' : ''; +const authDomain = authURL?.hostname ? (authURL.hostname === 'localhost' ? authURL.hostname : `.${authURL.hostname.split('.').slice(-2).join('.')}`) : ''; const html = ({ url, token }) => { return ` @@ -111,10 +111,10 @@ const authConfig = { html: html({ url, token: otp }), text: text({ url, token: otp }), }), - }) + }); if (!res.ok) - throw new Error('Resend error: ' + JSON.stringify(await res.json())) + throw new Error('Resend error: ' + JSON.stringify(await res.json())); }, }), ],