aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/object-storage/shared
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/object-storage/shared')
-rw-r--r--server/lib/object-storage/shared/client.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/server/lib/object-storage/shared/client.ts b/server/lib/object-storage/shared/client.ts
index c9a614593..d5cb074df 100644
--- a/server/lib/object-storage/shared/client.ts
+++ b/server/lib/object-storage/shared/client.ts
@@ -1,8 +1,22 @@
1import { S3Client } from '@aws-sdk/client-s3' 1import { S3Client } from '@aws-sdk/client-s3'
2import { NodeHttpHandler } from '@aws-sdk/node-http-handler'
2import { logger } from '@server/helpers/logger' 3import { logger } from '@server/helpers/logger'
4import { isProxyEnabled } from '@server/helpers/proxy'
5import { getAgent } from '@server/helpers/requests'
3import { CONFIG } from '@server/initializers/config' 6import { CONFIG } from '@server/initializers/config'
4import { lTags } from './logger' 7import { lTags } from './logger'
5 8
9function getProxyRequestHandler () {
10 if (!isProxyEnabled()) return null
11
12 const { agent } = getAgent()
13
14 return new NodeHttpHandler({
15 httpAgent: agent.http,
16 httpsAgent: agent.https
17 })
18}
19
6let endpointParsed: URL 20let endpointParsed: URL
7function getEndpointParsed () { 21function getEndpointParsed () {
8 if (endpointParsed) return endpointParsed 22 if (endpointParsed) return endpointParsed
@@ -26,7 +40,8 @@ function getClient () {
26 accessKeyId: OBJECT_STORAGE.CREDENTIALS.ACCESS_KEY_ID, 40 accessKeyId: OBJECT_STORAGE.CREDENTIALS.ACCESS_KEY_ID,
27 secretAccessKey: OBJECT_STORAGE.CREDENTIALS.SECRET_ACCESS_KEY 41 secretAccessKey: OBJECT_STORAGE.CREDENTIALS.SECRET_ACCESS_KEY
28 } 42 }
29 : undefined 43 : undefined,
44 requestHandler: getProxyRequestHandler()
30 }) 45 })
31 46
32 logger.info('Initialized S3 client %s with region %s.', getEndpoint(), OBJECT_STORAGE.REGION, lTags()) 47 logger.info('Initialized S3 client %s with region %s.', getEndpoint(), OBJECT_STORAGE.REGION, lTags())