mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-09 15:38:03 -05:00
refactor: replace CDN_URL with CDN_HOST in Dockerfiles and update related scripts for asset loading
This commit is contained in:
@@ -29,11 +29,11 @@ export default defineConfig(({ mode }) => {
|
||||
"0.0.1"
|
||||
).replaceAll(".", "-");
|
||||
|
||||
// CDN URL for static assets in /assets/* only.
|
||||
// Docker: Set CDN_URL env var at runtime (placeholder replaced at container startup).
|
||||
// Direct build: Use --build-arg CDN_URL=https://... or VITE_CDN_URL env var.
|
||||
// CDN HOST for static assets in /assets/* only.
|
||||
// Docker: Set CDN_HOST env var at runtime (placeholder replaced at container startup).
|
||||
// Direct build: Use --build-arg CDN_HOST=https://... or VITE_CDN_HOST env var.
|
||||
// Default: Empty = same-origin asset loading.
|
||||
const cdnUrl = env.VITE_CDN_URL || "";
|
||||
const cdnHost = env.VITE_CDN_HOST || "";
|
||||
|
||||
return {
|
||||
base: "/",
|
||||
@@ -60,10 +60,10 @@ export default defineConfig(({ mode }) => {
|
||||
}
|
||||
},
|
||||
experimental: {
|
||||
// Only apply CDN URL to files in /assets/* directory
|
||||
// Only apply CDN HOST to files in /assets/* directory
|
||||
renderBuiltUrl(filename) {
|
||||
if (filename.startsWith("assets/") && cdnUrl) {
|
||||
return `${cdnUrl}/${filename}`;
|
||||
if (filename.startsWith("assets/") && cdnHost) {
|
||||
return `${cdnHost}/${filename}`;
|
||||
}
|
||||
return `/${filename}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user