Introduced Secrets Manager

This commit is contained in:
2025-09-28 17:43:21 +02:00
parent 4d9b1f1dff
commit 83fc24be0c
13 changed files with 79 additions and 32 deletions

View File

@@ -4,6 +4,7 @@ import { s3 } from "../utils/s3"
import {GetObjectCommand, PutObjectCommand} from "@aws-sdk/client-s3"
import {getSignedUrl} from "@aws-sdk/s3-request-presigner";
import archiver from "archiver"
import {secrets} from "../utils/secrets"
export default async function fileRoutes(server: FastifyInstance) {
await server.register(multipart,{
@@ -59,7 +60,7 @@ export default async function fileRoutes(server: FastifyInstance) {
const fileKey = `${tenantId}/filesbyid/${createdFileData.id}/${data.filename}`
await s3.send(new PutObjectCommand({
Bucket: process.env.S3_BUCKET || "FEDEO",
Bucket: secrets.S3_BUCKET,
Key: fileKey,
Body: fileBuffer,
ContentType: data.mimetype,
@@ -143,7 +144,7 @@ export default async function fileRoutes(server: FastifyInstance) {
}
const command = new GetObjectCommand({
Bucket: process.env.S3_BUCKET || "FEDEO",
Bucket: secrets.S3_BUCKET,
Key: data.path,
})
@@ -187,7 +188,7 @@ export default async function fileRoutes(server: FastifyInstance) {
for (const entry of supabaseFiles) {
const command = new GetObjectCommand({
Bucket: process.env.S3_BUCKET || "FEDEO",
Bucket: secrets.S3_BUCKET,
Key: entry.path,
})
@@ -217,7 +218,7 @@ export default async function fileRoutes(server: FastifyInstance) {
const {data,error} = await server.supabase.from("files").select("*").eq("id", id).single()
const command = new GetObjectCommand({
Bucket: process.env.S3_BUCKET || "FEDEO",
Bucket: secrets.S3_BUCKET,
Key: data.path,
});
@@ -256,7 +257,7 @@ export default async function fileRoutes(server: FastifyInstance) {
if(!key) console.log(file)
const command = new GetObjectCommand({
Bucket: process.env.S3_BUCKET || "FEDEO",
Bucket: secrets.S3_BUCKET,
Key: key,
})