diff --git a/activestorage/CHANGELOG.md b/activestorage/CHANGELOG.md index 51fe89c829..a9ec650f46 100644 --- a/activestorage/CHANGELOG.md +++ b/activestorage/CHANGELOG.md @@ -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. diff --git a/activestorage/lib/active_storage/engine.rb b/activestorage/lib/active_storage/engine.rb index 1547cf302b..9b6523d6f6 100644 --- a/activestorage/lib/active_storage/engine.rb +++ b/activestorage/lib/active_storage/engine.rb @@ -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) diff --git a/guides/source/active_storage_overview.md b/guides/source/active_storage_overview.md index c00331b94f..6effc2587e 100644 --- a/guides/source/active_storage_overview.md +++ b/guides/source/active_storage_overview.md @@ -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`: