S3ServerSide for both local/live envs, env vars for local endpoints #166
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
S3LocalDev and S3ServerSide differ significantly only by the S3
API client, and the prefix for the short URL. Apply DRY to the two
classes so that the same code is exercised both in local and live
environments, injecting appropriate state into S3ServerSide at
runtime
Blocks #123
Solution
DependencyIds: Define new constants for s3Client and fileURLPrefix
S3ServerSide: Use injectable ctor parameters instead of module-level
constants
inversify.config: Rework config so that only S3ServerSide inputs
are determined by
NODE_ENV
, not the entire s3 dependencyapi/user
: Use the s3 held by the container, not the methodsit destructures into, so that we can properly refer to the object's
state through
this
Rework
aws.test.ts
to account for changesRemove S3LocalDev, no longer used
feat: allow S3 endpoints to be controlled by env vars
Tests
aws.test.ts
now fully fleshed out with mocksDeploy Notes
Deploy to staging to verify that Go still works as intended
New environment variables:
BUCKET_ENDPOINT
: the endpoint that Go will use to talk to S3 when uploading files/aclsACCESS_ENDPOINT
: used to generate the long URLs for file links