transloadit / uppy

The next open source file uploader for web browsers :dog:

Home Page:https://uppy.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When using aws-s3, force endpoints to be the same as Companion to simplify setup

Murderlon opened this issue · comments

Initial checklist

  • I understand this is a feature request and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Problem

We strongly discourage using Companion just for S3 signing if aren't using Companion already. But when you need to implement it for you own backend, we require an embarrassing amount of almost 600 lines of complex code (client, server).

When you use companion, it's as simple as this:

uppy.use(AwsS3, {
  shouldUseMultipart: (file) => file.size > 100 * 2 ** 20,
  companionUrl: 'https://companion.uppy.io',
});

Solution

Why don't we force people to have the exact same endpoints as Companion? Then we only have to rename companionUrl and they can do this:

uppy.use(AwsS3, {
  shouldUseMultipart: (file) => file.size > 100 * 2 ** 20,
  endpoint: 'https://mycoolserver/uppy-s3',
});

Alternatives

Export the logic from the package so they only need to write a couple lines of code. This might make more sense if there are likely edge cases where people need to do other things than what our code does.

I think that's more or less what I suggested back in #4265.

I still think companion-client should't be touched here and remain a strict API for Companion. But changing the option in aws-s3 is fine.

Can you think of any reason why people would need to deviate from our client-side code? Then the mentioned alternative may be better.