File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,3 +18,11 @@ export const appStaticConfig = {
1818
1919export const CDN_HOST = 'cdn.innei.ren'
2020export const TENCENT_CDN_DOMAIN = CDN_HOST
21+
22+ export const s3Config = {
23+ accessKeyId : process . env . S3_ACCESS_KEY as string ,
24+ secretAccessKey : process . env . S3_SECRET_KEY as string ,
25+ bucket : 'uploads' ,
26+ customDomain : 'https://object.innei.in' ,
27+ endpoint : `https://de7ecb0eaa0a328071255d557a6adb66.r2.cloudflarestorage.com` ,
28+ }
Original file line number Diff line number Diff line change @@ -3,19 +3,12 @@ import type { NextRequest } from 'next/server'
33
44import { PutObjectCommand , S3Client } from '@aws-sdk/client-s3'
55
6+ import { s3Config as config } from '~/app.static.config'
67import { apiClient } from '~/lib/request'
78
8- const config = {
9- accountId : 'de7ecb0eaa0a328071255d557a6adb66' ,
10- accessKeyId : process . env . S3_ACCESS_KEY as string ,
11- secretAccessKey : process . env . S3_SECRET_KEY as string ,
12- bucket : 'uploads' ,
13- customDomain : 'https://object.innei.in' ,
14- }
15-
169const s3 = new S3Client ( {
1710 region : 'auto' ,
18- endpoint : `https:// ${ config . accountId } .r2.cloudflarestorage.com` ,
11+ endpoint : config . endpoint ,
1912 credentials : {
2013 accessKeyId : config . accessKeyId ,
2114 secretAccessKey : config . secretAccessKey ,
You can’t perform that action at this time.
0 commit comments