11import type { NextConfig } from 'next'
2- import { env , isTruthy } from './lib/env'
2+ import { env , getEnv , isTruthy } from './lib/env'
33import { isDev , isHosted } from './lib/environment'
44import { getMainCSPPolicy , getWorkflowExecutionCSPPolicy } from './lib/security/csp'
55
@@ -15,7 +15,7 @@ const nextConfig: NextConfig = {
1515 protocol : 'https' ,
1616 hostname : 'api.stability.ai' ,
1717 } ,
18- // Vercel Blob Storage (allow any project-specific public blob hostname)
18+ // Vercel Blob Storage
1919 {
2020 protocol : 'https' ,
2121 hostname : '*.public.blob.vercel-storage.com' ,
@@ -25,7 +25,7 @@ const nextConfig: NextConfig = {
2525 protocol : 'https' ,
2626 hostname : '*.blob.core.windows.net' ,
2727 } ,
28- // AWS S3 - various regions and bucket configurations
28+ // AWS S3
2929 {
3030 protocol : 'https' ,
3131 hostname : '*.s3.amazonaws.com' ,
@@ -39,22 +39,22 @@ const nextConfig: NextConfig = {
3939 hostname : 'lh3.googleusercontent.com' ,
4040 } ,
4141 // Custom domain for file storage if configured
42- ...( env . NEXT_PUBLIC_BLOB_BASE_URL
42+ ...( getEnv ( ' NEXT_PUBLIC_BLOB_BASE_URL' )
4343 ? [
4444 {
4545 protocol : 'https' as const ,
46- hostname : new URL ( env . NEXT_PUBLIC_BLOB_BASE_URL ) . hostname ,
46+ hostname : new URL ( getEnv ( ' NEXT_PUBLIC_BLOB_BASE_URL' ) ! ) . hostname ,
4747 } ,
4848 ]
4949 : [ ] ) ,
5050 // Brand logo domain if configured
51- ...( env . NEXT_PUBLIC_BRAND_LOGO_URL
51+ ...( getEnv ( ' NEXT_PUBLIC_BRAND_LOGO_URL' )
5252 ? ( ( ) => {
5353 try {
5454 return [
5555 {
5656 protocol : 'https' as const ,
57- hostname : new URL ( env . NEXT_PUBLIC_BRAND_LOGO_URL ) . hostname ,
57+ hostname : new URL ( getEnv ( ' NEXT_PUBLIC_BRAND_LOGO_URL' ) ! ) . hostname ,
5858 } ,
5959 ]
6060 } catch {
@@ -63,13 +63,13 @@ const nextConfig: NextConfig = {
6363 } ) ( )
6464 : [ ] ) ,
6565 // Brand favicon domain if configured
66- ...( env . NEXT_PUBLIC_BRAND_FAVICON_URL
66+ ...( getEnv ( ' NEXT_PUBLIC_BRAND_FAVICON_URL' )
6767 ? ( ( ) => {
6868 try {
6969 return [
7070 {
7171 protocol : 'https' as const ,
72- hostname : new URL ( env . NEXT_PUBLIC_BRAND_FAVICON_URL ) . hostname ,
72+ hostname : new URL ( getEnv ( ' NEXT_PUBLIC_BRAND_FAVICON_URL' ) ! ) . hostname ,
7373 } ,
7474 ]
7575 } catch {
0 commit comments