From 7cfd5f544e00fe6c42fdd56e342313d7e2bf128b Mon Sep 17 00:00:00 2001 From: LittleNa1000 Date: Fri, 1 Nov 2024 19:58:55 +0700 Subject: [PATCH] web: debug, api: add BUCKET_NAME env --- apps/api/.env.example | 1 + apps/api/src/aws/aws.service.ts | 4 ++-- apps/web/src/app/page.tsx | 1 + apps/web/src/app/trpc.ts | 6 ++++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/api/.env.example b/apps/api/.env.example index 4df5db4c..40987393 100644 --- a/apps/api/.env.example +++ b/apps/api/.env.example @@ -8,5 +8,6 @@ ACCESS= SECRET_KEY= ENDPOINT= REGION= +BUCKET_NAME= INTANIA_AUTH_SECRET= \ No newline at end of file diff --git a/apps/api/src/aws/aws.service.ts b/apps/api/src/aws/aws.service.ts index dc884e91..fc8b491f 100644 --- a/apps/api/src/aws/aws.service.ts +++ b/apps/api/src/aws/aws.service.ts @@ -43,7 +43,7 @@ export class AwsService { try { await this.s3Client.send( new PutObjectCommand({ - Bucket: 'project-tracker', + Bucket: process.env.BUCKET_NAME, Key: storedFileName, Body: file, }), @@ -57,7 +57,7 @@ export class AwsService { async getUrlToFile(fileName: string, folderName?: string): Promise { const isPdf = fileName.slice(-4) == '.pdf'; - const bucketName = 'project-tracker'; + const bucketName = process.env.BUCKET_NAME; const pathToFile = folderName ? `${folderName}/${fileName}` : fileName; let command: GetObjectCommand; if (isPdf) { diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsx index 00b3568a..92e5fe12 100644 --- a/apps/web/src/app/page.tsx +++ b/apps/web/src/app/page.tsx @@ -22,6 +22,7 @@ export default function Page() { ดำเนินการเรื่องเอกสารของคณะฯ ไม่ยุ่งยาก สะดวก รวดเร็ว ครบจบทุกกระบวนการ มาเริ่มต้นเอกสารกัน ! + debugs: {env('INTANIA_AUTH_APP_ID')} {process.env.INTANIA_AUTH_APP_ID}