diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-31 15:57:37 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-31 15:57:37 -0500 |
commit | 90a8e0698db59d2f4ba137ea11c21783d6f9c66a (patch) | |
tree | c7e4f0683a3949808bad4daa1e4feafd31bc800c /activestorage | |
parent | 54663f55efd93c5e4f649fd1ad2833a853261507 (diff) | |
download | rails-90a8e0698db59d2f4ba137ea11c21783d6f9c66a.tar.gz rails-90a8e0698db59d2f4ba137ea11c21783d6f9c66a.tar.bz2 rails-90a8e0698db59d2f4ba137ea11c21783d6f9c66a.zip |
Use config/storage.yml as part of the skeleton and loading
Diffstat (limited to 'activestorage')
-rw-r--r-- | activestorage/README.md | 2 | ||||
-rw-r--r-- | activestorage/config/storage_services.yml | 34 | ||||
-rw-r--r-- | activestorage/lib/active_storage/engine.rb | 2 | ||||
-rw-r--r-- | activestorage/lib/active_storage/service.rb | 2 |
4 files changed, 3 insertions, 37 deletions
diff --git a/activestorage/README.md b/activestorage/README.md index 4a5f03233d..e8ab3b4633 100644 --- a/activestorage/README.md +++ b/activestorage/README.md @@ -91,7 +91,7 @@ Variation of image attachment: 2. Add `require "active_storage"` to config/application.rb, after `require "rails/all"` line. 3. Run `rails activestorage:install` to create needed directories, migrations, and configuration. 4. Configure the storage service in `config/environments/*` with `config.active_storage.service = :local` - that references the services configured in `config/storage_services.yml`. + that references the services configured in `config/storage.yml`. 5. Optional: Add `gem "aws-sdk", "~> 2"` to your Gemfile if you want to use AWS S3. 6. Optional: Add `gem "google-cloud-storage", "~> 1.3"` to your Gemfile if you want to use Google Cloud Storage. 7. Optional: Add `gem "mini_magick"` to your Gemfile if you want to use variants. diff --git a/activestorage/config/storage_services.yml b/activestorage/config/storage_services.yml deleted file mode 100644 index 057e15e74d..0000000000 --- a/activestorage/config/storage_services.yml +++ /dev/null @@ -1,34 +0,0 @@ -test: - service: Disk - root: <%= Rails.root.join("tmp/storage") %> - -local: - service: Disk - root: <%= Rails.root.join("storage") %> - -# Use rails secrets:edit to set the AWS secrets (as shared:aws:access_key_id|secret_access_key) -amazon: - service: S3 - access_key_id: <%= Rails.application.secrets.dig(:aws, :access_key_id) %> - secret_access_key: <%= Rails.application.secrets.dig(:aws, :secret_access_key) %> - region: us-east-1 - bucket: your_own_bucket - -# Remember not to checkin your GCS keyfile to a repository -google: - service: GCS - project: your_project - keyfile: <%= Rails.root.join("path/to/gcs.keyfile") %> - bucket: your_own_bucket - -microsoft: - service: Azure - path: your_azure_storage_path - storage_account_name: your_account_name - storage_access_key: <%= Rails.application.secrets.azure[:secret_access_key] %> - container: your_container_name - -mirror: - service: Mirror - primary: local - mirrors: [ amazon, google ] diff --git a/activestorage/lib/active_storage/engine.rb b/activestorage/lib/active_storage/engine.rb index 71861b84ae..d1f05986ba 100644 --- a/activestorage/lib/active_storage/engine.rb +++ b/activestorage/lib/active_storage/engine.rb @@ -31,7 +31,7 @@ module ActiveStorage initializer "active_storage.services" do config.after_initialize do |app| if config_choice = app.config.active_storage.service - config_file = Pathname.new(Rails.root.join("config/storage_services.yml")) + config_file = Pathname.new(Rails.root.join("config/storage.yml")) raise("Couldn't find Active Storage configuration in #{config_file}") unless config_file.exist? require "yaml" diff --git a/activestorage/lib/active_storage/service.rb b/activestorage/lib/active_storage/service.rb index b648c51823..7559fd0e2b 100644 --- a/activestorage/lib/active_storage/service.rb +++ b/activestorage/lib/active_storage/service.rb @@ -10,7 +10,7 @@ require "active_storage/log_subscriber" # * +Mirror+, to be able to use several services to manage attachments. # # Inside a Rails application, you can set-up your services through the -# generated <tt>config/storage_services.yml</tt> file and reference one +# generated <tt>config/storage.yml</tt> file and reference one # of the aforementioned constant under the +service+ key. For example: # # local: |