diff --git a/.env.development b/.env.development index a2e762f7..87c2ba14 100644 --- a/.env.development +++ b/.env.development @@ -27,4 +27,6 @@ AWS_REGION="ap-northeast-1" AMPLIFY_BUCKET="files.hanasys.jp" AWS_ACCESS_KEY_ID="AKIA3K4QWLZHFZRJOM2E" AWS_SECRET_ACCESS_KEY="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" -NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" \ No newline at end of file +NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" + +S3_PROFILE="dev" \ No newline at end of file diff --git a/.env.local.dev b/.env.local.dev index dc91dbc7..ab789dbf 100644 --- a/.env.local.dev +++ b/.env.local.dev @@ -27,4 +27,6 @@ AWS_REGION="ap-northeast-1" AMPLIFY_BUCKET="files.hanasys.jp" AWS_ACCESS_KEY_ID="AKIA3K4QWLZHFZRJOM2E" AWS_SECRET_ACCESS_KEY="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" -NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" \ No newline at end of file +NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" + +S3_PROFILE="dev" \ No newline at end of file diff --git a/.env.localhost b/.env.localhost index bca449ce..8617d87c 100644 --- a/.env.localhost +++ b/.env.localhost @@ -27,4 +27,6 @@ AWS_REGION="ap-northeast-1" AMPLIFY_BUCKET="files.hanasys.jp" AWS_ACCESS_KEY_ID="AKIA3K4QWLZHFZRJOM2E" AWS_SECRET_ACCESS_KEY="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" -NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" \ No newline at end of file +NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" + +S3_PROFILE="dev" \ No newline at end of file diff --git a/.env.production b/.env.production index 6295bb97..bb3dfbf0 100644 --- a/.env.production +++ b/.env.production @@ -28,4 +28,6 @@ AWS_REGION="ap-northeast-1" AMPLIFY_BUCKET="files.hanasys.jp" AWS_ACCESS_KEY_ID="AKIA3K4QWLZHFZRJOM2E" AWS_SECRET_ACCESS_KEY="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" -NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" \ No newline at end of file +NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" + +S3_PROFILE="prd" \ No newline at end of file diff --git a/src/app/api/image/canvas/route.js b/src/app/api/image/canvas/route.js index 0a4d0be2..77d1c95c 100644 --- a/src/app/api/image/canvas/route.js +++ b/src/app/api/image/canvas/route.js @@ -96,7 +96,7 @@ export async function POST(req) { /** * 크롭 이미지 이름을 결정한다. */ - const Key = `Drawing/${objectNo}_${planNo}_${type}.png` + const Key = `Drawing/${process.env.S3_PROFILE}/${objectNo}_${planNo}_${type}.png` /** * 크롭이 완료된 이미지를 업로드한다. diff --git a/src/app/api/image/estimate-image-copy/route.js b/src/app/api/image/estimate-image-copy/route.js index d7c80b13..81e5c13c 100644 --- a/src/app/api/image/estimate-image-copy/route.js +++ b/src/app/api/image/estimate-image-copy/route.js @@ -20,7 +20,7 @@ export async function POST(req) { const isExistImage1 = await s3.send( new GetObjectCommand({ Bucket, - Key: `Drawing/${objectNo}_${planNo}_1.png`, + Key: `Drawing/${process.env.S3_PROFILE}/${objectNo}_${planNo}_1.png`, }), ) @@ -28,7 +28,7 @@ export async function POST(req) { const isExistImage2 = await s3.send( new GetObjectCommand({ Bucket, - Key: `Drawing/${objectNo}_${planNo}_2.png`, + Key: `Drawing/${process.env.S3_PROFILE}/${objectNo}_${planNo}_2.png`, }), ) @@ -37,16 +37,16 @@ export async function POST(req) { //견적서1 번 이미지 복사 const copyCommand = new CopyObjectCommand({ Bucket, - CopySource: encodeURI(`${Bucket}/Drawing/${objectNo}_${planNo}_1.png`), - Key: `Drawing/${newObjectNo}_${newPlanNo}_1.png`, + CopySource: encodeURI(`${Bucket}/Drawing/${process.env.S3_PROFILE}/${objectNo}_${planNo}_1.png`), + Key: `Drawing/${process.env.S3_PROFILE}/${newObjectNo}_${newPlanNo}_1.png`, }) const response = await s3.send(copyCommand) const copyCommand2 = new CopyObjectCommand({ Bucket, - CopySource: encodeURI(`${Bucket}/Drawing/${objectNo}_${planNo}_2.png`), - Key: `Drawing/${newObjectNo}_${newPlanNo}_2.png`, + CopySource: encodeURI(`${Bucket}/Drawing/${process.env.S3_PROFILE}/${objectNo}_${planNo}_2.png`), + Key: `Drawing/${process.env.S3_PROFILE}/${newObjectNo}_${newPlanNo}_2.png`, }) const response2 = await s3.send(copyCommand2) diff --git a/src/hooks/useEvent.js b/src/hooks/useEvent.js index 8b7b687d..43328376 100644 --- a/src/hooks/useEvent.js +++ b/src/hooks/useEvent.js @@ -401,7 +401,7 @@ export function useEvent() { const removeMouseEvent = (type) => { mouseEventListeners.current = mouseEventListeners.current.filter((event) => { if (event.eventType === type) { - canvas.off(type, event.handler) + canvas?.off(type, event.handler) return false } return true