ghost-storage-adapter-s3
Advanced tools
Comparing version 2.2.1 to 2.3.0
15
index.js
@@ -46,3 +46,4 @@ 'use strict'; | ||
region = config.region, | ||
secretAccessKey = config.secretAccessKey; | ||
secretAccessKey = config.secretAccessKey, | ||
endpoint = config.endpoint; | ||
@@ -60,2 +61,3 @@ // Compatible with the aws-sdk's default environment variables | ||
this.pathPrefix = stripLeadingSlash(process.env.GHOST_STORAGE_ADAPTER_S3_PATH_PREFIX || pathPrefix || ''); | ||
this.endpoint = process.env.GHOST_STORAGE_ADAPTER_S3_ENDPOINT || endpoint || ''; | ||
} | ||
@@ -96,3 +98,3 @@ | ||
s3() { | ||
return new _awsSdk2.default.S3({ | ||
var options = { | ||
accessKeyId: this.accessKeyId, | ||
@@ -102,3 +104,7 @@ bucket: this.bucket, | ||
secretAccessKey: this.secretAccessKey | ||
}); | ||
}; | ||
if (this.endpoint !== '') { | ||
options.endpoint = this.endpoint; | ||
} | ||
return new _awsSdk2.default.S3(options); | ||
} | ||
@@ -144,4 +150,3 @@ | ||
res.status(404); | ||
console.log(err + '\nkey: ' + stripLeadingSlash(req.path)); | ||
next(); | ||
next(err); | ||
}).pipe(res); | ||
@@ -148,0 +153,0 @@ }; |
@@ -75,3 +75,3 @@ { | ||
}, | ||
"version": "2.2.1" | ||
"version": "2.3.0" | ||
} |
@@ -10,3 +10,3 @@ # Ghost storage adapter S3 | ||
``` | ||
```shell | ||
npm install ghost-storage-adapter-s3 | ||
@@ -19,12 +19,13 @@ mkdir -p ./content/adapters/storage | ||
``` | ||
storage: { | ||
active: 's3', | ||
s3: { | ||
accessKeyId: 'YOUR_ACCESS_KEY_ID', | ||
assetHost: 'YOUR_OPTIONAL_CDN_URL', | ||
bucket: 'YOUR_BUCKET_NAME', | ||
pathPrefix: 'YOUR_OPTIONAL_BUCKET_SUBDIRECTORY', | ||
region: 'YOUR_REGION_SLUG', | ||
secretAccessKey: 'YOUR_SECRET_ACCESS_KEY' | ||
```json | ||
"storage": { | ||
"active": "s3", | ||
"s3": { | ||
"accessKeyId": "YOUR_ACCESS_KEY_ID", | ||
"assetHost": "YOUR_OPTIONAL_CDN_URL", | ||
"bucket": "YOUR_BUCKET_NAME", | ||
"pathPrefix": "YOUR_OPTIONAL_BUCKET_SUBDIRECTORY", | ||
"region": "YOUR_REGION_SLUG", | ||
"secretAccessKey": "YOUR_SECRET_ACCESS_KEY", | ||
"endpoint": "YOUR_OPTIONAL_ENDPOINT_URL (only needed for 3rd party S3 providers)" | ||
} | ||
@@ -43,2 +44,3 @@ } | ||
GHOST_STORAGE_ADAPTER_S3_PATH_PREFIX // optional | ||
GHOST_STORAGE_ADAPTER_S3_ENDPOINT // optional | ||
``` | ||
@@ -45,0 +47,0 @@ |
@@ -23,3 +23,4 @@ import AWS from 'aws-sdk' | ||
region, | ||
secretAccessKey | ||
secretAccessKey, | ||
endpoint | ||
} = config | ||
@@ -37,2 +38,3 @@ | ||
this.pathPrefix = stripLeadingSlash(process.env.GHOST_STORAGE_ADAPTER_S3_PATH_PREFIX || pathPrefix || '') | ||
this.endpoint = process.env.GHOST_STORAGE_ADAPTER_S3_ENDPOINT || endpoint || '' | ||
} | ||
@@ -69,3 +71,3 @@ | ||
s3 () { | ||
return new AWS.S3({ | ||
const options = { | ||
accessKeyId: this.accessKeyId, | ||
@@ -75,3 +77,7 @@ bucket: this.bucket, | ||
secretAccessKey: this.secretAccessKey | ||
}) | ||
} | ||
if (this.endpoint !== '') { | ||
options.endpoint = this.endpoint | ||
} | ||
return new AWS.S3(options) | ||
} | ||
@@ -114,4 +120,3 @@ | ||
res.status(404) | ||
console.log(err + '\nkey: ' + stripLeadingSlash(req.path)) | ||
next() | ||
next(err) | ||
}) | ||
@@ -118,0 +123,0 @@ .pipe(res) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143630
269
48
16