Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

refactor: add distribution host env variable

Marc Seitzb0fd68657583
diff --git a/.env.example b/.env.example
index ad09c237..f92f667c 100644
--- a/.env.example
+++ b/.env.example
@@ -43,6 +43,8 @@ NEXT_PUBLIC_TRIGGER_PUBLIC_API_KEY=
# [[STORAGE]]
# Defines the storage transport to use. Available options: vercel (default) | s3
NEXT_PUBLIC_UPLOAD_TRANSPORT="vercel"
+# REQUIRED: Defines the distribution host (without protocol) to use for the storage transport. Either cloudfront, s3, or vercel blob host. Used in next.config.mjs configuration.
+NEXT_PRIVATE_UPLOAD_DISTRIBUTION_HOST="<BLOB_STORE_ID>.public.blob.vercel-storage.com" | "<DISTRIBUTION_ID>.cloudfront.net" | "<BUCKET_NAME>.s3.<REGION>.amazonaws.com"
# OPTIONAL: Defines the endpoint to use for the S3 storage transport. Relevant when using third-party S3-compatible providers.
NEXT_PRIVATE_UPLOAD_ENDPOINT=""
# Defines the region to use for the S3 storage transport. Defaults to us-east-1.
diff --git a/components/view/PagesViewer.tsx b/components/view/PagesViewer.tsx
index b79f0847..59692ad5 100644
--- a/components/view/PagesViewer.tsx
+++ b/components/view/PagesViewer.tsx
@@ -204,7 +204,7 @@ export default function PagesViewer({
{pages && loadedImages[pageNumber - 1] ? (
pages.map((page, index) => {
// contains cloudfront.net in the file path, then use img tag otherwise use next/image
- if (page.file.toLowerCase().includes("cloudfront.net")) {
+ if (page.file.toLowerCase().includes("files.papermark.io")) {
return (
<img
key={index}
diff --git a/next.config.mjs b/next.config.mjs
index 7e8c46c2..855ad120 100644
--- a/next.config.mjs
+++ b/next.config.mjs
@@ -11,13 +11,9 @@ const nextConfig = {
hostname: "assets.papermark.io",
},
{
- // special document pages
+ // user-shared documents and files
protocol: "https",
- hostname: "d36r2enbzam0iu.cloudfront.net",
- },
- {
- protocol: "https",
- hostname: "dev-to-uploads.s3.amazonaws.com",
+ hostname: process.env.NEXT_PRIVATE_UPLOAD_DISTRIBUTION_HOST,
},
{
// twitter img
@@ -41,29 +37,29 @@ const nextConfig = {
port: "3000",
},
{
- // staging img
+ // special document pages
protocol: "https",
- hostname: "36so9a8uzykxknsu.public.blob.vercel-storage.com",
+ hostname: "d36r2enbzam0iu.cloudfront.net",
},
{
- // production img
+ // staging vercel blob
protocol: "https",
- hostname: "yoywvlh29jppecbh.public.blob.vercel-storage.com",
+ hostname: "36so9a8uzykxknsu.public.blob.vercel-storage.com",
},
{
- // development / staging hosted user img
+ // production vercel blob
protocol: "https",
- hostname: "d16lliwzxm242j.cloudfront.net",
+ hostname: "yoywvlh29jppecbh.public.blob.vercel-storage.com",
},
{
- // production hosted user img
+ // blog images
protocol: "https",
- hostname: "d1ff41ind5a7r1.cloudfront.net",
+ hostname: "aicontentfy-customer-images.s3.eu-central-1.amazonaws.com",
},
{
- // blog images
+ // also blog images
protocol: "https",
- hostname: "aicontentfy-customer-images.s3.eu-central-1.amazonaws.com",
+ hostname: "dev-to-uploads.s3.amazonaws.com",
},
],
},