2019-05-08 14:06:36 +01:00
|
|
|
[](https://circleci.com/gh/cderche/greenlock-storage-s3)
|
2019-05-09 13:28:17 +01:00
|
|
|
[](https://codeclimate.com/github/cderche/greenlock-storage-s3/maintainability)
|
|
|
|
[](https://codeclimate.com/github/cderche/greenlock-storage-s3/test_coverage)
|
2019-05-08 16:28:43 +01:00
|
|
|
[](https://snyk.io/test/github/cderche/greenlock-storage-s3)
|
2019-05-09 13:28:17 +01:00
|
|
|
|
|
|
|

|
|
|
|

|
|
|
|

|
2019-05-08 14:06:36 +01:00
|
|
|
|
2019-05-08 10:38:04 +01:00
|
|
|
# greenlock-storage-s3
|
2019-05-08 10:42:14 +01:00
|
|
|
S3 backed storage strategy for greenlock-express.js (and greenlock.js)
|
2019-05-08 10:52:09 +01:00
|
|
|
|
2019-05-08 11:43:59 +01:00
|
|
|
## Requirements
|
2019-05-08 10:52:09 +01:00
|
|
|
|
2019-05-08 15:25:23 +01:00
|
|
|
You will need a s3 bucket and the corresponding credentials.
|
2019-05-08 15:20:09 +01:00
|
|
|
|
|
|
|
## Integration
|
|
|
|
|
|
|
|
### greenlock-express.js
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
2019-05-08 15:25:23 +01:00
|
|
|
let store = require('greenlock-storage-s3').create({
|
2019-05-08 15:51:26 +01:00
|
|
|
accessKeyId: accessKeyId // Replace with your accessKeyId
|
|
|
|
, secretAccessKey: secretAccessKey // Replace with your secretAccessKey
|
|
|
|
, regionName: regionName // Replace with your regionName
|
|
|
|
, bucketName: bucketName // Replace with your bucketName
|
2019-05-08 15:20:09 +01:00
|
|
|
, configDir: 'acme/' // Recommended
|
|
|
|
, accountsDir: 'accounts/' // Recommended
|
|
|
|
, debug: true // Debug
|
|
|
|
});
|
|
|
|
|
|
|
|
var Greenlock = require("greenlock-express");
|
|
|
|
|
|
|
|
var greenlock = Greenlock.create({
|
|
|
|
// Other options
|
|
|
|
, store: store
|
|
|
|
});
|
|
|
|
|
|
|
|
// Continue your greenlock setup
|
|
|
|
|
|
|
|
```
|
2019-05-08 10:52:09 +01:00
|
|
|
|
2019-05-08 15:49:17 +01:00
|
|
|
## Testing
|
|
|
|
|
2019-05-08 18:29:53 +01:00
|
|
|
The strategy is tested against the [greenlock-store-test](https://git.coolaj86.com/coolaj86/greenlock-store-test.js)
|
2019-05-08 15:49:17 +01:00
|
|
|
|
|
|
|
To run the tests yourself, create a `.env` file with the following
|
|
|
|
|
2019-05-09 00:12:15 +01:00
|
|
|
```console
|
2019-05-08 15:49:17 +01:00
|
|
|
// .env file
|
2019-05-08 15:51:26 +01:00
|
|
|
AWS_ACCESS_KEY_ID=abc // Replace with your accessKeyId
|
|
|
|
AWS_SECRET_ACCESS_KEY=abc // Replace with your secretAccessKey
|
|
|
|
AWS_BUCKET_REGION=abc // Replace with your regionName
|
|
|
|
AWS_BUCKET_NAME=abc // Replace with your bucketName
|
2019-05-08 15:49:17 +01:00
|
|
|
```
|
|
|
|
|
2019-05-08 15:51:26 +01:00
|
|
|
Run the following command:
|
|
|
|
```console
|
|
|
|
$ npm run clean && npm run test && npm run clean
|
|
|
|
```
|
2019-05-08 15:49:17 +01:00
|
|
|
|
2019-05-08 11:43:59 +01:00
|
|
|
## License
|
2019-05-08 10:52:09 +01:00
|
|
|
|
2019-05-08 14:06:36 +01:00
|
|
|
ISC
|