Support per-environment ASt service config

This commit is contained in:
Pietro Moro 2020-09-29 15:59:52 +02:00 committed by GitHub
parent 57bd5f0df8
commit 1e2cd7a75e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,7 @@
* Add per-environment configuration support
*Pietro Moro*
* The Poppler PDF previewer renders a preview image using the original
document's crop box rather than its media box, hiding print margins. This
matches the behavior of the MuPDF previewer.

View File

@ -116,7 +116,8 @@ module ActiveStorage
ActiveSupport.on_load(:active_storage_blob) do
configs = Rails.configuration.active_storage.service_configurations ||=
begin
config_file = Rails.root.join("config/storage.yml")
config_file = Rails.root.join("config/storage/#{Rails.env}.yml")
config_file = Rails.root.join("config/storage.yml") unless config_file.exist?
raise("Couldn't find Active Storage configuration in #{config_file}") unless config_file.exist?
ActiveSupport::ConfigurationFile.parse(config_file)

View File

@ -97,6 +97,10 @@ config.active_storage.service = :test
Continue reading for more information on the built-in service adapters (e.g.
`Disk` and `S3`) and the configuration they require.
NOTE: Configuration files that are environment-specific will take precedence:
in production, for example, the `config/storage/production.yml` file (if existent)
will take precedence over the `config/storage.yml` file.
### Disk Service
Declare a Disk service in `config/storage.yml`: