chore: changes for deployment to get the pocketbase public url variable value
This commit is contained in:
+6
-4
@@ -1,8 +1,10 @@
|
||||
import type { NextConfig } from 'next';
|
||||
|
||||
/* PocketBase origin — used to allowlist remote images.
|
||||
* PB_HOSTNAME and PB_PORT are server-only env vars; safe to read here. */
|
||||
const pbHostname = process.env.PB_HOSTNAME ?? '127.0.0.1';
|
||||
/* Public PocketBase host for the image optimizer allowlist.
|
||||
* Derived from PB_PUBLIC_URL (e.g. https://cms.allmy.work) at BUILD time —
|
||||
* remotePatterns is frozen into the build, so PB_PUBLIC_URL must be present
|
||||
* during `next build` in CI (via build-arg), not just at runtime. */
|
||||
const pbPublicHost = process.env.PB_PUBLIC_URL ? new URL(process.env.PB_PUBLIC_URL).hostname : '127.0.0.1';
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
output: 'standalone',
|
||||
@@ -11,7 +13,7 @@ const nextConfig: NextConfig = {
|
||||
remotePatterns: [
|
||||
{
|
||||
protocol: 'https',
|
||||
hostname: pbHostname,
|
||||
hostname: pbPublicHost,
|
||||
pathname: '/api/files/**',
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user