Merge pull request 'add support for custom s3 servers' (#1) from custom-s3 into develop
Some checks are pending
CI / test (mysql, cucumber, 3.2) (push) Waiting to run
CI / test (mysql, cucumber, 3.3) (push) Waiting to run
CI / test (mysql, other, 3.2) (push) Waiting to run
CI / test (mysql, other, 3.3) (push) Waiting to run
CI / test (postgresql, cucumber, 3.2) (push) Waiting to run
CI / test (postgresql, cucumber, 3.3) (push) Waiting to run
CI / test (postgresql, other, 3.2) (push) Waiting to run
CI / test (postgresql, other, 3.3) (push) Waiting to run

Reviewed-on: #1
This commit is contained in:
astra 2024-10-08 13:34:15 +00:00
commit 87a355a86c
3 changed files with 10 additions and 1 deletions

View file

@ -25,6 +25,8 @@ defaults:
bucket:
region:
cache: true
host: "s3.amazonaws.com"
endpoint: "https://s3.amazonaws.com"
image_redirect_url:
assets:
serve: false

View file

@ -113,6 +113,8 @@
#secret = "change_me"
#bucket = "my_photos"
#region = "us-east-1"
#host = "s3.amazonaws.com"
#endpoint = "https://s3.amazonaws.com"
## Use max-age header on Amazon S3 resources (default=true).
## When true, this allows locally cached images to be served for up to

View file

@ -16,13 +16,18 @@ CarrierWave.configure do |config|
provider: 'AWS',
aws_access_key_id: AppConfig.environment.s3.key.get,
aws_secret_access_key: AppConfig.environment.s3.secret.get,
region: AppConfig.environment.s3.region.get
region: AppConfig.environment.s3.region.get,
host: AppConfig.environment.s3.host.get,
endpoint: AppConfig.environment.s3.endpoint.get,
# XXX: what does this actually do? does it do anything anymore?
path_style: true
}
if AppConfig.environment.s3.cache?
config.fog_attributes['Cache-Control'] = 'max-age=31536000'
end
config.fog_directory = AppConfig.environment.s3.bucket.get
config.asset_host = AppConfig.environment.image_redirect_url.get
else
config.storage = :file
end