- Added `NEXT_PUBLIC_APP_URL` and `NEXT_PUBLIC_CONTACT_EMAIL` to environment variables for frontend configuration. - Updated CORS logic to support domain-based restrictions with dynamic origin validation. - Improved frontend image hostname resolution using environment-driven URLs. - Standardized contact email usage across the application.
33 lines
616 B
TypeScript
33 lines
616 B
TypeScript
import type { NextConfig } from "next";
|
|
|
|
const appUrl = process.env.NEXT_PUBLIC_APP_URL || "https://memegoat.fr";
|
|
const apiUrl = process.env.NEXT_PUBLIC_API_URL || "https://api.memegoat.fr";
|
|
|
|
const getHostname = (url: string) => {
|
|
try {
|
|
return new URL(url).hostname;
|
|
} catch {
|
|
return url;
|
|
}
|
|
};
|
|
|
|
const nextConfig: NextConfig = {
|
|
/* config options here */
|
|
reactCompiler: true,
|
|
images: {
|
|
remotePatterns: [
|
|
{
|
|
protocol: "https",
|
|
hostname: getHostname(appUrl),
|
|
},
|
|
{
|
|
protocol: "https",
|
|
hostname: getHostname(apiUrl),
|
|
},
|
|
],
|
|
},
|
|
output: "standalone",
|
|
};
|
|
|
|
export default nextConfig;
|