add support for custom s3 servers
Some checks failed
CI / test (mysql, cucumber, 3.2) (pull_request) Has been cancelled
CI / test (mysql, cucumber, 3.3) (pull_request) Has been cancelled
CI / test (mysql, other, 3.2) (pull_request) Has been cancelled
CI / test (mysql, other, 3.3) (pull_request) Has been cancelled
CI / test (postgresql, cucumber, 3.2) (pull_request) Has been cancelled
CI / test (postgresql, cucumber, 3.3) (pull_request) Has been cancelled
CI / test (postgresql, other, 3.2) (pull_request) Has been cancelled
CI / test (postgresql, other, 3.3) (pull_request) Has been cancelled
Lint / pronto (pull_request) Has been cancelled

This commit is contained in:
astra 2024-10-08 08:54:29 -04:00
parent 37096d9c88
commit 6e3fc0fd12
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