mirror of
https://github.com/beilunyang/moemail.git
synced 2026-09-05 23:36:37 +08:00
refactor: Update email and webhook configurations in deploy workflow
This commit is contained in:
@@ -106,22 +106,26 @@ jobs:
|
|||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
run: |
|
run: |
|
||||||
if [ -z "${{ steps.previoustag.outputs.tag }}" ]; then
|
if [ -z "${{ steps.previoustag.outputs.tag }}" ]; then
|
||||||
if git ls-files | grep -q "workers/email-receiver.ts"; then
|
# Check email worker and its dependencies
|
||||||
|
if git ls-files | grep -q -E "workers/email-receiver.ts|app/lib/schema.ts|app/lib/webhook.ts|app/config/webhook.ts"; then
|
||||||
echo "email_worker_changed=true" >> $GITHUB_OUTPUT
|
echo "email_worker_changed=true" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "email_worker_changed=false" >> $GITHUB_OUTPUT
|
echo "email_worker_changed=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
# Check cleanup worker
|
||||||
if git ls-files | grep -q "workers/cleanup.ts"; then
|
if git ls-files | grep -q "workers/cleanup.ts"; then
|
||||||
echo "cleanup_worker_changed=true" >> $GITHUB_OUTPUT
|
echo "cleanup_worker_changed=true" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "cleanup_worker_changed=false" >> $GITHUB_OUTPUT
|
echo "cleanup_worker_changed=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if git diff ${{ steps.previoustag.outputs.tag }}..HEAD --name-only | grep -q "workers/email-receiver.ts"; then
|
# Check email worker and its dependencies changes
|
||||||
|
if git diff ${{ steps.previoustag.outputs.tag }}..HEAD --name-only | grep -q -E "workers/email-receiver.ts|app/lib/schema.ts|app/lib/webhook.ts|app/config/webhook.ts"; then
|
||||||
echo "email_worker_changed=true" >> $GITHUB_OUTPUT
|
echo "email_worker_changed=true" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "email_worker_changed=false" >> $GITHUB_OUTPUT
|
echo "email_worker_changed=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
# Check cleanup worker changes
|
||||||
if git diff ${{ steps.previoustag.outputs.tag }}..HEAD --name-only | grep -q "workers/cleanup.ts"; then
|
if git diff ${{ steps.previoustag.outputs.tag }}..HEAD --name-only | grep -q "workers/cleanup.ts"; then
|
||||||
echo "cleanup_worker_changed=true" >> $GITHUB_OUTPUT
|
echo "cleanup_worker_changed=true" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
export const EMAIL_CONFIG = {
|
||||||
|
MAX_ACTIVE_EMAILS: 30, // Maximum number of active emails
|
||||||
|
POLL_INTERVAL: 10_000, // Polling interval in milliseconds
|
||||||
|
DOMAIN: process.env.NEXT_PUBLIC_EMAIL_DOMAIN || 'moemail.app', // Email domain
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export type EmailConfig = typeof EMAIL_CONFIG
|
||||||
+2
-14
@@ -1,14 +1,2 @@
|
|||||||
export const EMAIL_CONFIG = {
|
export * from './email'
|
||||||
MAX_ACTIVE_EMAILS: 30, // Maximum number of active emails
|
export * from './webhook'
|
||||||
POLL_INTERVAL: 10_000, // Polling interval in milliseconds
|
|
||||||
DOMAIN: process.env.NEXT_PUBLIC_EMAIL_DOMAIN || 'moemail.app', // Email domain
|
|
||||||
} as const
|
|
||||||
|
|
||||||
export const WEBHOOK_CONFIG = {
|
|
||||||
MAX_RETRIES: 3, // Maximum retry count
|
|
||||||
TIMEOUT: 10_000, // Timeout time (milliseconds)
|
|
||||||
RETRY_DELAY: 1000, // Retry delay (milliseconds)
|
|
||||||
EVENTS: {
|
|
||||||
NEW_MESSAGE: 'new_message',
|
|
||||||
}
|
|
||||||
} as const
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
export const WEBHOOK_CONFIG = {
|
||||||
|
MAX_RETRIES: 3, // Maximum retry count
|
||||||
|
TIMEOUT: 10_000, // Timeout time (milliseconds)
|
||||||
|
RETRY_DELAY: 1000, // Retry delay (milliseconds)
|
||||||
|
EVENTS: {
|
||||||
|
NEW_MESSAGE: 'new_message',
|
||||||
|
}
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export type WebhookConfig = typeof WEBHOOK_CONFIG
|
||||||
@@ -3,7 +3,7 @@ import { drizzle } from 'drizzle-orm/d1'
|
|||||||
import { messages, emails, webhooks } from '../app/lib/schema'
|
import { messages, emails, webhooks } from '../app/lib/schema'
|
||||||
import { eq } from 'drizzle-orm'
|
import { eq } from 'drizzle-orm'
|
||||||
import PostalMime from 'postal-mime'
|
import PostalMime from 'postal-mime'
|
||||||
import { WEBHOOK_CONFIG } from '../app/config'
|
import { WEBHOOK_CONFIG } from '../app/config/webhook'
|
||||||
import { EmailMessage } from '../app/lib/webhook'
|
import { EmailMessage } from '../app/lib/webhook'
|
||||||
|
|
||||||
const handleEmail = async (message: ForwardableEmailMessage, env: Env) => {
|
const handleEmail = async (message: ForwardableEmailMessage, env: Env) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user