chore: update storage configuration for production

- Change active storage service to use `:build` or `:amazon`
- Added a new `build` service for local disk storage

This update allows for better flexibility in managing file
storage based on the environment. The configuration now checks
the `RAILS_BUILD` environment variable to decide on the
storage service, making it easier to handle local testing and
production deployments without manual adjustments.
This commit is contained in:
songtianlun 2025-01-22 17:26:06 +08:00
parent 3748ea5215
commit 494ae40088
2 changed files with 5 additions and 1 deletions

View File

@ -22,7 +22,7 @@ Rails.application.configure do
# config.asset_host = "http://assets.example.com"
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :amazon
config.active_storage.service = ENV["RAILS_BUILD"] ? :build : :amazon
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
config.assume_ssl = true

View File

@ -6,6 +6,10 @@ local:
service: Disk
root: <%= Rails.root.join("storage") %>
build:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
# service: S3