Skip to content

Commit 9a5a850

Browse files
committed
fix: store external storage config correctly for s3, r2, gcs
1 parent dc96277 commit 9a5a850

22 files changed

Lines changed: 4946 additions & 10 deletions

apps/dashboard-api/src/controllers/project.controller.js

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -740,16 +740,30 @@ module.exports.updateExternalConfig = async (req, res) => {
740740
}
741741
}
742742

743-
if (storageUrl && storageKey) {
744-
const storageConfig = {
745-
storageUrl,
746-
storageKey,
747-
storageProvider: storageProvider || "supabase",
748-
};
749-
updateData["resources.storage.config"] = encrypt(
750-
JSON.stringify(storageConfig),
751-
);
752-
updateData["resources.storage.isExternal"] = true;
743+
if (storageProvider === "supabase" || (!storageProvider && storageUrl && storageKey)) {
744+
if (storageUrl && storageKey) {
745+
const storageConfig = {
746+
storageUrl,
747+
storageKey,
748+
storageProvider: "supabase",
749+
};
750+
updateData["resources.storage.config"] = encrypt(JSON.stringify(storageConfig));
751+
updateData["resources.storage.isExternal"] = true;
752+
}
753+
} else if (["s3", "cloudflare_r2", "gcs"].includes(storageProvider)) {
754+
if (validatedData.s3AccessKeyId && validatedData.s3SecretAccessKey && validatedData.s3Bucket) {
755+
const storageConfig = {
756+
storageProvider,
757+
accessKeyId: validatedData.s3AccessKeyId,
758+
secretAccessKey: validatedData.s3SecretAccessKey,
759+
region: validatedData.s3Region,
760+
endpoint: validatedData.s3Endpoint,
761+
bucket: validatedData.s3Bucket,
762+
publicUrlHost: validatedData.publicUrlHost,
763+
};
764+
updateData["resources.storage.config"] = encrypt(JSON.stringify(storageConfig));
765+
updateData["resources.storage.isExternal"] = true;
766+
}
753767
}
754768

755769
const project = await Project.findOneAndUpdate(
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": 3,
3+
"routes": [
4+
{
5+
"handle": "filesystem"
6+
},
7+
{
8+
"src": "^/_astro/(.*)$",
9+
"headers": {
10+
"cache-control": "public, max-age=31536000, immutable"
11+
},
12+
"continue": true
13+
},
14+
{
15+
"src": "^/.*$",
16+
"dest": "/404.html",
17+
"status": 404
18+
}
19+
]
20+
}

apps/landing/.vercel/output/static/404.html

Lines changed: 19 additions & 0 deletions
Large diffs are not rendered by default.
138 KB
Loading

apps/landing/.vercel/output/static/_astro/Hyperspeed.yI-RiApA.js

Lines changed: 4383 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/landing/.vercel/output/static/_astro/MagicBento.uA1weagR.js

Lines changed: 94 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/landing/.vercel/output/static/_astro/OrbitSection.Dd5_q2xi.js

Lines changed: 236 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/landing/.vercel/output/static/_astro/StudioReplay.Bvvd5Fn1.js

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)