use the actual bucket path variable thing now

pull/29/head
tycrek 3 years ago
parent 587551716e
commit cec58fc5b7
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -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: {

@ -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 })
});

Loading…
Cancel
Save