File tree 2 files changed +10
-9
lines changed
2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -18,3 +18,11 @@ export const appStaticConfig = {
18
18
19
19
export const CDN_HOST = 'cdn.innei.ren'
20
20
export 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'
3
3
4
4
import { PutObjectCommand , S3Client } from '@aws-sdk/client-s3'
5
5
6
+ import { s3Config as config } from '~/app.static.config'
6
7
import { apiClient } from '~/lib/request'
7
8
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
-
16
9
const s3 = new S3Client ( {
17
10
region : 'auto' ,
18
- endpoint : `https:// ${ config . accountId } .r2.cloudflarestorage.com` ,
11
+ endpoint : config . endpoint ,
19
12
credentials : {
20
13
accessKeyId : config . accessKeyId ,
21
14
secretAccessKey : config . secretAccessKey ,
You can’t perform that action at this time.
0 commit comments