1
0
Fork 0
mirror of https://github.com/seejohnrun/haste-server.git synced 2024-11-24 21:41:21 +00:00

Add support for additional S3-compatible providers

This commit is contained in:
Caelan Sayler 2021-12-01 15:41:53 +00:00
parent 7af15cc32d
commit 3f7aa64d15
2 changed files with 26 additions and 5 deletions

View file

@ -253,10 +253,10 @@ Once you've done that, your config section should look like this:
}
```
Authentication is handled automatically by the client. Check
[Amazon's documentation](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html)
for more information. You will need to grant your role these permissions to
your bucket:
Authentication can be handled in the config (by adding `keyId` and `keySecret` properties to the above example), or separately by the client SDK.
See [Amazon's documentation](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html) for more information.
You will need to create an IAM user and retrieve an access key. The IAM user should have the the following permissions:
```json
{
@ -274,6 +274,18 @@ your bucket:
}
```
**Alternative S3 API Providers:** A number of other storage providers support the S3 API (such as Linode, BackBlaze B2, etc). To use one of those providers, you will need to specify an endpoint in your config instead of a region:
```json
{
"type": "amazon-s3",
"bucket": "your-bucket-name",
"endpoint": "s3.example.backblazeb2.com",
"keyId": "9387200",
"keySecret": "H93lmz_93hla9jhdl/Example"
}
```
## Docker
### Build image

View file

@ -6,7 +6,16 @@ var winston = require('winston');
var AmazonS3DocumentStore = function(options) {
this.expire = options.expire;
this.bucket = options.bucket;
this.client = new AWS.S3({region: options.region});
var config = {};
if(options.endpoint)
config.endpoint = new AWS.Endpoint(options.endpoint);
if(options.region)
config.region = options.region;
if(options.keyId && options.keySecret)
config.credentials = new AWS.Credentials({ accessKeyId: options.keyId, secretAccessKey: options.keySecret })
this.client = new AWS.S3(config);
};
AmazonS3DocumentStore.prototype.get = function(key, callback, skipExpire) {