-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathplugins.ts
111 lines (100 loc) · 2.49 KB
/
plugins.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
export default ({ env }) => {
const awsS3Config = prepareAwsS3Config(env)
if (!awsS3Config) {
console.info(
"AWS S3 upload configuration is not complete. Local file storage will be used."
)
}
return {
upload: {
config: awsS3Config ?? localUploadConfig,
},
seo: {
enabled: true,
},
"config-sync": {
enabled: true,
},
"strapi-v5-plugin-populate-deep": {
config: {
defaultDepth: 5,
},
},
"users-permissions": {
config: {
jwt: {
expiresIn: "30d", // this value is synced with NextAuth session maxAge
},
},
},
sentry: {
enabled: true,
config: {
// Only set `dsn` property in production
dsn: env("NODE_ENV") === "production" ? env("SENTRY_DSN") : null,
sendMetadata: true,
},
},
// email: {
// config: {
// provider: "mailgun",
// providerOptions: {
// key: env("MAILGUN_API_KEY"),
// domain: env("MAILGUN_DOMAIN"),
// url: env("MAILGUN_HOST", "https://api.eu.mailgun.net"),
// },
// settings: {
// defaultFrom: env("MAILGUN_EMAIL"),
// defaultReplyTo: env("MAILGUN_EMAIL"),
// },
// },
// },
}
}
const localUploadConfig: any = {
// Local provider setup
// https://docs.strapi.io/dev-docs/plugins/upload
sizeLimit: 250 * 1024 * 1024, // 256mb in bytes,
}
const prepareAwsS3Config = (env) => {
const awsAccessKeyId = env("AWS_ACCESS_KEY_ID")
const awsAccessSecret = env("AWS_ACCESS_SECRET")
const awsRegion = env("AWS_REGION")
const awsBucket = env("AWS_BUCKET")
const awsRequirements = [
awsAccessKeyId,
awsAccessSecret,
awsRegion,
awsBucket,
]
const awsRequirementsOk = awsRequirements.every(
(req) => req != null && req !== ""
)
if (awsRequirementsOk) {
return {
provider: "aws-s3",
providerOptions: {
baseUrl: env("CDN_URL"),
rootPath: env("CDN_ROOT_PATH"),
s3Options: {
credentials: {
accessKeyId: awsAccessKeyId,
secretAccessKey: awsAccessSecret,
},
region: awsRegion,
params: {
ACL: env("AWS_ACL", "public-read"),
signedUrlExpires: env("AWS_SIGNED_URL_EXPIRES", 15 * 60),
Bucket: awsBucket,
},
},
},
actionOptions: {
upload: {},
uploadStream: {},
delete: {},
},
}
}
return undefined
}