From cec58fc5b7a96fd04a528a916988bf208474b202 Mon Sep 17 00:00:00 2001 From: tycrek Date: Mon, 12 Jul 2021 17:39:32 -0600 Subject: [PATCH] use the actual bucket path variable thing now --- setup.js | 8 ++++---- storage.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/setup.js b/setup.js index a5ae3e1..b1c0305 100755 --- a/setup.js +++ b/setup.js @@ -16,7 +16,7 @@ const config = { s3enabled: false, s3endpoint: 'sfo3.digitaloceanspaces.com', s3bucket: 'bucket-name', - s3bucketEndpoint: false, + s3usePathStyle: false, s3accessKey: 'accessKey', s3secretKey: 'secretKey', }; @@ -144,10 +144,10 @@ if (require.main === module) { default: config.s3bucket, required: false }, - s3bucketEndpoint: { - description: 'Whether the provided endpoint is a bucket path (true) or a bucket subdomain (false)', + s3usePathStyle: { + description: 'S3 path endpoint, otherwise uses subdomain endpoint', type: 'boolean', - default: config.s3bucketEndpoint, + default: config.s3usePathStyle, required: false }, s3accessKey: { diff --git a/storage.js b/storage.js index 7828439..776608e 100644 --- a/storage.js +++ b/storage.js @@ -8,14 +8,14 @@ const Thumbnail = require('./thumbnails'); const Vibrant = require('./vibrant'); const Hash = require('./hash'); const { getDatedDirname, sanitize, generateId, formatBytes, log } = require('./utils'); -const { s3enabled, s3endpoint, s3bucket, s3bucketEndpoint, s3accessKey, s3secretKey, saveAsOriginal, maxUploadSize, mediaStrict } = require('./config.json'); +const { s3enabled, s3endpoint, s3bucket, s3usePathStyle, s3accessKey, s3secretKey, saveAsOriginal, maxUploadSize, mediaStrict } = require('./config.json'); const { CODE_UNSUPPORTED_MEDIA_TYPE } = require('./MagicNumbers.json'); const ID_GEN_LENGTH = 32; const ALLOWED_MIMETYPES = /(image)|(video)|(audio)\//; const s3 = new aws.S3({ - s3BucketEndpoint: s3bucketEndpoint, + s3ForcePathStyle: s3usePathStyle, endpoint: new aws.Endpoint(s3endpoint), credentials: new aws.Credentials({ accessKeyId: s3accessKey, secretAccessKey: s3secretKey }) });