diff --git a/.env.example b/.env.example index e09caf70..d874055a 100644 --- a/.env.example +++ b/.env.example @@ -10,10 +10,11 @@ POSTGRES_PASSWORD= # SMTP (optional) SMTP_HOST= -SMTP_PORT=465 # Port 587 will not work +SMTP_PORT=465 SMTP_USER= SMTP_PASSWORD= EMAIL_FROM= # e.g. "Kan " +SMTP_SECURE= # set to "false" to use port 587 # S3 storage (optional) S3_REGION= diff --git a/README.md b/README.md index af05c82e..d0d5b05b 100644 --- a/README.md +++ b/README.md @@ -138,34 +138,35 @@ pnpm dev ## Environment Variables 🔐 -| Variable | Description | Required | Example | -| -------------------------------- | ----------------------------- | ------------------ | --------------------------------------------- | -| `POSTGRES_URL` | PostgreSQL connection URL | Yes | `postgres://user:pass@localhost:5432/db` | -| `EMAIL_FROM` | Sender email address | For Email | `"Kan "` | -| `SMTP_HOST` | SMTP server hostname | For Email | `smtp.resend.com` | -| `SMTP_PORT` | SMTP server port | For Email | `465` | -| `SMTP_USER` | SMTP username/email | For Email | `resend` | -| `SMTP_PASSWORD` | SMTP password/token | For Email | `re_xxxx` | -| `NEXT_PUBLIC_BASE_URL` | Base URL of your installation | Yes | `http://localhost:3000` | -| `BETTER_AUTH_SECRET` | Auth encryption secret | Yes | Random 32+ char string | -| `BETTER_AUTH_TRUSTED_ORIGINS` | Allowed callback origins | No | `http://localhost:3000,http://localhost:3001` | -| `GOOGLE_CLIENT_ID` | Google OAuth client ID | For Google login | `xxx.apps.googleusercontent.com` | -| `GOOGLE_CLIENT_SECRET` | Google OAuth client secret | For Google login | `xxx` | -| `DISCORD_CLIENT_ID` | Discord OAuth client ID | For Discord login | `xxx` | -| `DISCORD_CLIENT_SECRET` | Discord OAuth client secret | For Discord login | `xxx` | -| `GITHUB_CLIENT_ID` | GitHub OAuth client ID | For GitHub login | `xxx` | -| `GITHUB_CLIENT_SECRET` | GitHub OAuth client secret | For GitHub login | `xxx` | -| `TRELLO_APP_API_KEY` | Trello app API key | For Trello import | `xxx` | -| `TRELLO_APP_API_SECRET` | Trello app API secret | For Trello import | `xxx` | -| `S3_REGION` | S3 storage region | For file uploads | `WEUR` | -| `S3_ENDPOINT` | S3 endpoint URL | For file uploads | `https://xxx.r2.cloudflarestorage.com` | -| `S3_ACCESS_KEY_ID` | S3 access key | For file uploads | `xxx` | -| `S3_SECRET_ACCESS_KEY` | S3 secret key | For file uploads | `xxx` | -| `NEXT_PUBLIC_STORAGE_URL` | Storage service URL | For file uploads | `https://storage.kanbn.com` | -| `NEXT_PUBLIC_STORAGE_DOMAIN` | Storage domain name | For file uploads | `kanbn.com` | -| `NEXT_PUBLIC_AVATAR_BUCKET_NAME` | S3 bucket name for avatars | For file uploads | `avatars` | -| `NEXT_PUBLIC_ALLOW_CREDENTIALS` | Allow email & password login | For authentication | `true` | -| `NEXT_PUBLIC_DISABLE_SIGN_UP` | Disable sign up | For authentication | `false` | +| Variable | Description | Required | Example | +| -------------------------------- | -------------------------------------------------------- | ------------------ | --------------------------------------------- | +| `POSTGRES_URL` | PostgreSQL connection URL | Yes | `postgres://user:pass@localhost:5432/db` | +| `EMAIL_FROM` | Sender email address | For Email | `"Kan "` | +| `SMTP_HOST` | SMTP server hostname | For Email | `smtp.resend.com` | +| `SMTP_PORT` | SMTP server port | For Email | `465` | +| `SMTP_USER` | SMTP username/email | No | `resend` | +| `SMTP_PASSWORD` | SMTP password/token | No | `re_xxxx` | +| `SMTP_SECURE` | Use secure SMTP connection (defaults to true if not set) | For Email | `true` | +| `NEXT_PUBLIC_BASE_URL` | Base URL of your installation | Yes | `http://localhost:3000` | +| `BETTER_AUTH_SECRET` | Auth encryption secret | Yes | Random 32+ char string | +| `BETTER_AUTH_TRUSTED_ORIGINS` | Allowed callback origins | No | `http://localhost:3000,http://localhost:3001` | +| `GOOGLE_CLIENT_ID` | Google OAuth client ID | For Google login | `xxx.apps.googleusercontent.com` | +| `GOOGLE_CLIENT_SECRET` | Google OAuth client secret | For Google login | `xxx` | +| `DISCORD_CLIENT_ID` | Discord OAuth client ID | For Discord login | `xxx` | +| `DISCORD_CLIENT_SECRET` | Discord OAuth client secret | For Discord login | `xxx` | +| `GITHUB_CLIENT_ID` | GitHub OAuth client ID | For GitHub login | `xxx` | +| `GITHUB_CLIENT_SECRET` | GitHub OAuth client secret | For GitHub login | `xxx` | +| `TRELLO_APP_API_KEY` | Trello app API key | For Trello import | `xxx` | +| `TRELLO_APP_API_SECRET` | Trello app API secret | For Trello import | `xxx` | +| `S3_REGION` | S3 storage region | For file uploads | `WEUR` | +| `S3_ENDPOINT` | S3 endpoint URL | For file uploads | `https://xxx.r2.cloudflarestorage.com` | +| `S3_ACCESS_KEY_ID` | S3 access key | For file uploads | `xxx` | +| `S3_SECRET_ACCESS_KEY` | S3 secret key | For file uploads | `xxx` | +| `NEXT_PUBLIC_STORAGE_URL` | Storage service URL | For file uploads | `https://storage.kanbn.com` | +| `NEXT_PUBLIC_STORAGE_DOMAIN` | Storage domain name | For file uploads | `kanbn.com` | +| `NEXT_PUBLIC_AVATAR_BUCKET_NAME` | S3 bucket name for avatars | For file uploads | `avatars` | +| `NEXT_PUBLIC_ALLOW_CREDENTIALS` | Allow email & password login | For authentication | `true` | +| `NEXT_PUBLIC_DISABLE_SIGN_UP` | Disable sign up | For authentication | `false` | See `.env.example` for a complete list of supported environment variables. diff --git a/cloud/docker-compose.yml b/cloud/docker-compose.yml index 65015556..b74def0b 100644 --- a/cloud/docker-compose.yml +++ b/cloud/docker-compose.yml @@ -28,6 +28,7 @@ services: - SMTP_PORT=${SMTP_PORT} - SMTP_USER=${SMTP_USER} - SMTP_PASSWORD=${SMTP_PASSWORD} + - SMTP_SECURE=${SMTP_SECURE} - EMAIL_FROM=${EMAIL_FROM} # S3 storage diff --git a/docker-compose.yml b/docker-compose.yml index deaca027..afc1a137 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -81,14 +81,6 @@ services: - APPLE_CLIENT_ID=${APPLE_CLIENT_ID} - APPLE_CLIENT_SECRET=${APPLE_CLIENT_SECRET} - APPLE_APP_BUNDLE_IDENTIFIER=${APPLE_APP_BUNDLE_IDENTIFIER} - - # Cloud (not required) - - NEXT_PUBLIC_KAN_ENV=${NEXT_PUBLIC_KAN_ENV} - - NEXT_PUBLIC_UMAMI_ID=${NEXT_PUBLIC_UMAMI_ID} - - STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY} - - STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET} - - NEXT_PUBLIC_POSTHOG_KEY=${NEXT_PUBLIC_POSTHOG_KEY} - - NEXT_PUBLIC_POSTHOG_HOST=${NEXT_PUBLIC_POSTHOG_HOST} depends_on: - postgres restart: unless-stopped diff --git a/packages/email/src/sendEmail.tsx b/packages/email/src/sendEmail.tsx index 4baff474..41ed1d23 100644 --- a/packages/email/src/sendEmail.tsx +++ b/packages/email/src/sendEmail.tsx @@ -16,11 +16,14 @@ const emailTemplates: Record = { const transporter = nodemailer.createTransport({ host: process.env.SMTP_HOST, port: Number(process.env.SMTP_PORT), - secure: true, - auth: { - user: process.env.SMTP_USER, - pass: process.env.SMTP_PASSWORD, - }, + secure: process.env.SMTP_SECURE !== "false", + ...(process.env.SMTP_USER && + process.env.SMTP_PASSWORD && { + auth: { + user: process.env.SMTP_USER, + pass: process.env.SMTP_PASSWORD, + }, + }), }); export const sendEmail = async ( diff --git a/turbo.json b/turbo.json index f6df9e37..54918eae 100644 --- a/turbo.json +++ b/turbo.json @@ -91,6 +91,7 @@ "SMTP_PORT", "SMTP_USER", "SMTP_PASSWORD", + "SMTP_SECURE", "NEXT_PUBLIC_KAN_ENV", "STRIPE_SECRET_KEY", "STRIPE_WEBHOOK_SECRET",