Skip to content

Commit

Permalink
backend: allow configuring S3_REGION
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Jan 13, 2025
1 parent 7574030 commit 90d1886
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/bin/s3-create-bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

const Minio = require('minio');

const { server, bucketName, accessKey, secretKey } = require('config').get('default.external.s3blobStore');
const { server, region, bucketName, accessKey, secretKey } = require('config').get('default.external.s3blobStore');

const minioClient = (() => {
const url = new URL(server);
Expand All @@ -29,8 +29,8 @@ minioClient.bucketExists(bucketName)
return;
}

log('Creating bucket:', bucketName);
return minioClient.makeBucket(bucketName)
log('Creating bucket:', bucketName, 'in', region ?? 'default region');
return minioClient.makeBucket(bucketName, region)
.then(() => log('Bucket created OK.'));
})
.catch(err => {
Expand Down
4 changes: 2 additions & 2 deletions lib/external/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const disabled = { enabled: false };
const init = (config) => {
if (!config) return disabled;

const { server, accessKey, secretKey, bucketName, requestTimeout, objectPrefix } = config;
const { server, accessKey, secretKey, bucketName, region, requestTimeout, objectPrefix } = config;
if (!(server && accessKey && secretKey && bucketName)) return disabled;

const http = require('node:http');
Expand Down Expand Up @@ -83,7 +83,7 @@ const init = (config) => {
return req;
};

const clientConfig = { endPoint, port, useSSL, accessKey, secretKey, transport: { request } };
const clientConfig = { endPoint, port, useSSL, accessKey, secretKey, region, transport: { request } };

return new Minio.Client(clientConfig);
})();
Expand Down

0 comments on commit 90d1886

Please sign in to comment.