Support alternate S3 endpoints (#15445)

* Support alternate S3 endpoints

* Add missing comma

This is why we should use trailing commas

* Provide sample S3 endpoint config

* Comment out S3 image-storage config in .env_sample

See https://github.com/forem/forem/pull/15445#discussion_r754525723
This commit is contained in:
Jamie Gaskins 2022-01-18 11:34:42 -05:00 committed by GitHub
parent 97d62bac69
commit 8bdb2b6d8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View file

@ -72,11 +72,14 @@ NODE_ENV="development"
HONEYBADGER_API_KEY="Optional"
HONEYBADGER_JS_API_KEY="Optional"
# AWS for images storages
AWS_ID=
AWS_SECRET=
AWS_BUCKET_NAME=
AWS_UPLOAD_REGION=
# Uncomment the lines below and fill in values to enable AWS S3 (or S3-
# compatible services) for image storage. The AWS_S3_ENDPOINT variable is only
# necessary if you're using an S3-compatible service but not S3 proper.
# AWS_ID=
# AWS_SECRET=
# AWS_BUCKET_NAME=
# AWS_UPLOAD_REGION=
# AWS_S3_ENDPOINT=
# AWS for video storage
AWS_S3_INPUT_BUCKET="Optional"

View file

@ -27,7 +27,8 @@ module CarrierWaveInitializer
provider: "AWS",
aws_access_key_id: ApplicationConfig["AWS_ID"],
aws_secret_access_key: ApplicationConfig["AWS_SECRET"],
region: ApplicationConfig["AWS_UPLOAD_REGION"].presence || ApplicationConfig["AWS_DEFAULT_REGION"]
region: ApplicationConfig["AWS_UPLOAD_REGION"].presence || ApplicationConfig["AWS_DEFAULT_REGION"],
endpoint: ApplicationConfig["AWS_S3_ENDPOINT"],
}
end
end