reaction-file-collections-sa-s3
An AWS S3 adapter for reaction-file-collections, brought to you by out:grow.
Installation
Open a terminal in your project's reaction
(API) directory, and install the package from NPM using the following command:
npm install @outgrowio/reaction-file-collections-sa-s3
Configuration
Set up your AWS S3 credentials using environment variables:
AWS_S3_REGION=us-east-1
AWS_S3_ENDPOINT=http://some.endpoint.com:9000
AWS_S3_BUCKET=reaction-media
AWS_ACCESS_KEY_ID=QWERTYUIOPASDFGH
AWS_SECRET_ACCESS_KEY=<secret_key>
Usage
In your project's reaction
(API) directory, open /src/core-services/files/setUpFileCollections.js
.
Replace usages of GridFSStore
with S3Store
, starting from the import on line 19: const S3Store = require("@outgrowio/reaction-file-collections-sa-s3").default;
.
When replacing the GridFSStore
constructor with the S3Store
one, make sure to pass the following options:
new S3Store({
name,
isPublic: true,
objectACL: "public-read",
async transformWrite(fileRecord) {
}
});
Help
Need help integrating this plugin into your Reaction Commerce project? Simply looking for expert Reaction Commerce developers? Want someone to train your team to use Reaction at its fullest?
Whether it is just a one-hour consultation to get you set up or helping your team ship a whole project from start to finish, you can't go wrong by reaching out to us:
Contributing
Pull Requests, Issues and Feature Requests are welcome!