Introduced Secrets Manager
This commit is contained in:
@@ -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,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user