From f83d914133e81caea1d870a050f12190f268439c Mon Sep 17 00:00:00 2001 From: Francisco Solla Date: Sun, 15 Mar 2026 13:46:44 -0300 Subject: [PATCH] prepare for deploy through cPanel --- .env.example | 5 +++- app.js | 26 +++++++++++++++++++ app_wrapper.cjs | 1 + next.config.mjs | 4 +-- .../(frontend)/mandato-no-whatsapp/page.tsx | 17 +++++++++--- 5 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 app.js create mode 100644 app_wrapper.cjs diff --git a/.env.example b/.env.example index 99e5a632..cef72e80 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,5 @@ -DATABASE_URL=mongodb://127.0.0.1/your-database-name +DATABASE_URL=postgresql://USER:PASSWORD@HOST:5432/DATABASE PAYLOAD_SECRET=YOUR_SECRET_HERE +BLOB_READ_WRITE_TOKEN=YOUR_BLOB_TOKEN_HERE +NEXT_BASE_PATH=/mandato +NEXT_PUBLIC_SITE_URL=https://jorgesolla.com.br diff --git a/app.js b/app.js new file mode 100644 index 00000000..cc704b7c --- /dev/null +++ b/app.js @@ -0,0 +1,26 @@ +import { createServer } from 'node:http' +import next from 'next' + +const dev = process.env.NODE_ENV !== 'production' +const port = Number(process.env.PORT) || 3000 +const host = process.env.HOST || '127.0.0.1' + +const app = next({ + dev, + hostname: host, + port, +}) + +const handle = app.getRequestHandler() + +app + .prepare() + .then(() => { + createServer((req, res) => handle(req, res)).listen(port, host, () => { + console.log(`> Ready on http://${host}:${port}`) + }) + }) + .catch((error) => { + console.error('Failed to start Next.js server', error) + process.exit(1) + }) diff --git a/app_wrapper.cjs b/app_wrapper.cjs new file mode 100644 index 00000000..151253bd --- /dev/null +++ b/app_wrapper.cjs @@ -0,0 +1 @@ +(() => import('./app.js'))() diff --git a/next.config.mjs b/next.config.mjs index c0948898..74394258 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -2,8 +2,8 @@ import { withPayload } from '@payloadcms/next/withPayload' /** @type {import('next').NextConfig} */ const basePath = process.env.NEXT_BASE_PATH || '' -const assetPrefix = process.env.NEXT_ASSET_PREFIX || basePath || undefined -const allowedImageHost = process.env.NEXT_PUBLIC_SITE_URL +const assetPrefix = process.env.NEXT_ASSET_PREFIX || undefined +const allowedImageHost = process.env.NEXT_PUBLIC_SITE_URL || 'https://jorgesolla.com.br' const nextConfig = { basePath, diff --git a/src/app/(frontend)/mandato-no-whatsapp/page.tsx b/src/app/(frontend)/mandato-no-whatsapp/page.tsx index 432382fb..54487cc5 100644 --- a/src/app/(frontend)/mandato-no-whatsapp/page.tsx +++ b/src/app/(frontend)/mandato-no-whatsapp/page.tsx @@ -3,8 +3,13 @@ import { WhatsappForm } from '@/components/WhatsappForm' import Image from 'next/image' export default function Page() { + const basePath = process.env.NEXT_BASE_PATH || '' + return ( -
+

@@ -26,14 +31,20 @@ export default function Page() {

- +

Seus dados estão seguros. Utilizamos suas informações apenas para contato e envio de conteúdos relacionados.