1
1
import { FastifyInstance , RequestGenericInterface } from 'fastify'
2
2
import { FromSchema } from 'json-schema-to-ts'
3
3
import apiKey from '../../plugins/apikey'
4
- import { decrypt , encrypt } from '../../../ internal/auth'
4
+ import { decrypt , encrypt } from '@ internal/auth'
5
5
import {
6
6
deleteTenantConfig ,
7
7
TenantMigrationStatus ,
8
8
multitenantKnex ,
9
9
lastMigrationName ,
10
10
runMigrationsOnTenant ,
11
11
progressiveMigrations ,
12
- } from '../../../ internal/database'
12
+ } from '@ internal/database'
13
13
import { dbSuperUser , storage } from '../../plugins'
14
14
15
15
const patchSchema = {
@@ -35,6 +35,12 @@ const patchSchema = {
35
35
maxResolution : { type : 'number' , nullable : true } ,
36
36
} ,
37
37
} ,
38
+ s3Protocol : {
39
+ type : 'object' ,
40
+ properties : {
41
+ enabled : { type : 'boolean' } ,
42
+ } ,
43
+ } ,
38
44
} ,
39
45
} ,
40
46
} ,
@@ -75,6 +81,7 @@ interface tenantDBInterface {
75
81
} | null
76
82
service_key : string
77
83
file_size_limit ?: number
84
+ feature_s3_protocol ?: boolean
78
85
feature_image_transformation ?: boolean
79
86
image_transformation_max_resolution ?: number
80
87
}
@@ -96,6 +103,7 @@ export default async function routes(fastify: FastifyInstance) {
96
103
jwks,
97
104
service_key,
98
105
feature_image_transformation,
106
+ feature_s3_protocol,
99
107
image_transformation_max_resolution,
100
108
migrations_version,
101
109
migrations_status,
@@ -118,6 +126,9 @@ export default async function routes(fastify: FastifyInstance) {
118
126
enabled : feature_image_transformation ,
119
127
maxResolution : image_transformation_max_resolution ,
120
128
} ,
129
+ s3Protocol : {
130
+ enabled : feature_s3_protocol ,
131
+ } ,
121
132
} ,
122
133
} )
123
134
)
@@ -137,6 +148,7 @@ export default async function routes(fastify: FastifyInstance) {
137
148
jwt_secret,
138
149
jwks,
139
150
service_key,
151
+ feature_s3_protocol,
140
152
feature_image_transformation,
141
153
image_transformation_max_resolution,
142
154
migrations_version,
@@ -163,6 +175,9 @@ export default async function routes(fastify: FastifyInstance) {
163
175
enabled : feature_image_transformation ,
164
176
maxResolution : image_transformation_max_resolution ,
165
177
} ,
178
+ s3Protocol : {
179
+ enabled : feature_s3_protocol ,
180
+ } ,
166
181
} ,
167
182
migrationVersion : migrations_version ,
168
183
migrationStatus : migrations_status ,
@@ -197,6 +212,7 @@ export default async function routes(fastify: FastifyInstance) {
197
212
jwks,
198
213
service_key : encrypt ( serviceKey ) ,
199
214
feature_image_transformation : features ?. imageTransformation ?. enabled ?? false ,
215
+ feature_s3_protocol : features ?. s3Protocol ?. enabled ?? true ,
200
216
migrations_version : null ,
201
217
migrations_status : null ,
202
218
tracing_mode : tracingMode ,
@@ -250,6 +266,7 @@ export default async function routes(fastify: FastifyInstance) {
250
266
jwks,
251
267
service_key : serviceKey !== undefined ? encrypt ( serviceKey ) : undefined ,
252
268
feature_image_transformation : features ?. imageTransformation ?. enabled ,
269
+ feature_s3_protocol : features ?. s3Protocol ?. enabled ,
253
270
image_transformation_max_resolution :
254
271
features ?. imageTransformation ?. maxResolution === null
255
272
? null
@@ -315,6 +332,10 @@ export default async function routes(fastify: FastifyInstance) {
315
332
?. image_transformation_max_resolution as number | undefined
316
333
}
317
334
335
+ if ( typeof features ?. s3Protocol ?. enabled !== 'undefined' ) {
336
+ tenantInfo . feature_s3_protocol = features ?. s3Protocol ?. enabled
337
+ }
338
+
318
339
if ( databasePoolUrl ) {
319
340
tenantInfo . database_pool_url = encrypt ( databasePoolUrl )
320
341
}
0 commit comments