fix: docker build crash when STORAGE_PUBLIC_URL unset
compose.prod.yml passes STORAGE_PUBLIC_URL through ${STORAGE_PUBLIC_URL}
build args/env — when unset in .env.production, docker-compose
substitutes an empty string, not an absent var. ?? only falls back on
null/undefined, so next.config.ts's `new URL("")` threw and failed the
whole `pnpm --filter web build` step. Switched to || in next.config.ts
and lib/storage.ts so empty string also falls back to the default.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { S3Client, PutObjectCommand, DeleteObjectCommand } from "@aws-sdk/client-s3";
|
||||
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
|
||||
|
||||
const bucket = process.env["STORAGE_BUCKET"] ?? "epicure-uploads";
|
||||
const endpoint = process.env["STORAGE_ENDPOINT"] ?? "http://localhost:9000";
|
||||
const publicUrl = process.env["STORAGE_PUBLIC_URL"] ?? "http://localhost:9000";
|
||||
const bucket = process.env["STORAGE_BUCKET"] || "epicure-uploads";
|
||||
const endpoint = process.env["STORAGE_ENDPOINT"] || "http://localhost:9000";
|
||||
const publicUrl = process.env["STORAGE_PUBLIC_URL"] || "http://localhost:9000";
|
||||
|
||||
const credentials = {
|
||||
accessKeyId: process.env["STORAGE_ACCESS_KEY"] ?? "minioadmin",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const storagePublicUrl = process.env["STORAGE_PUBLIC_URL"] ?? "http://localhost:9000";
|
||||
const storagePublicUrl = process.env["STORAGE_PUBLIC_URL"] || "http://localhost:9000";
|
||||
const storageUrl = new URL(storagePublicUrl);
|
||||
const storageOrigin = storageUrl.origin;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user