ConduitPlatform / Conduit

Batteries-included backend that works with any stack.

Home Page:https://getconduit.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature]: Make S3 Storage Generic

scottymack opened this issue · comments

Checklist

  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the Issue Tracker for a feature request that matches the one I want to file, without success.

Suggestion

There are a lot of storage providers that are S3 compatible along with Amazon AWS (i.e Backblaze, Wasabi, etc...). The bulk of the groundwork has been done by implementing it as AWS S3, so I think it'll be pretty easy to make the S3 implementation generic rather than specific to AWS only. I was able to create a bucket and upload to Backblaze by simply specifying the Backblaze endpoint as part of the S3ClientConfig object.

  constructor(options: StorageConfig) {
    const config = {
      region: options.aws.region,
      credentials: {
        accessKeyId: options.aws.accessKeyId,
        secretAccessKey: options.aws.secretAccessKey,
      },
      endpoint: 'https://s3.us-west-002.backblazeb2.com',
    };
    this._storage = new S3Client(config);
  }

I think that we could add the option to specify an endpoint as part of the storage module config setup and then include it inside of the S3ClientConfig. This would allow S3 to be used with other S3 compatible storage providers.

Hey @scottymack, thanks for pointing this out.
We are definitely interested in supporting this 👍.

Seeing as you've already attempted this, would you be interested in submitting a PR for Storage?

Awesome! Yeah, I'll take a crack at it👍