improvement: docker infrastructure overhauled.
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
// frontend/next.config.js
|
||||
function publicAppHostname(): string | null {
|
||||
const url = process.env.NEXT_PUBLIC_APP_URL;
|
||||
if (!url) return null;
|
||||
try {
|
||||
return new URL(url).hostname;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const appHost = publicAppHostname();
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
// Enable React strict mode
|
||||
@@ -9,12 +20,19 @@ const nextConfig = {
|
||||
// Disable x-powered-by header for security
|
||||
poweredByHeader: false,
|
||||
|
||||
// Configure allowed remote image sources
|
||||
// Configure allowed remote image sources (hostname derived from NEXT_PUBLIC_APP_URL at build time)
|
||||
images: {
|
||||
remotePatterns:
|
||||
process.env.NODE_ENV === 'production'
|
||||
? [{ protocol: 'https', hostname: 'yourdomain.com' }]
|
||||
: [{ protocol: 'http', hostname: 'localhost' }],
|
||||
remotePatterns: [
|
||||
{ protocol: "http", hostname: "localhost" },
|
||||
...(appHost
|
||||
? [
|
||||
{ protocol: "http" as const, hostname: appHost },
|
||||
{ protocol: "https" as const, hostname: appHost },
|
||||
]
|
||||
: []),
|
||||
{ protocol: "https", hostname: "dyolink.com" },
|
||||
{ protocol: "https", hostname: "www.dyolink.com" },
|
||||
],
|
||||
},
|
||||
|
||||
// Environment variables that will be available at build time
|
||||
|
||||
Reference in New Issue
Block a user