diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-28 17:01:12 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-31 15:17:23 -0500 |
commit | 4687c86b91bc78834894a9acbdd2aa1b5cb5209b (patch) | |
tree | 37471e5f417a1c7ce64dd8061e15295891f3e1ee /railties/lib/rails | |
parent | 9330d01ada9ce6768d14c59b99cd3860e209737a (diff) | |
download | rails-4687c86b91bc78834894a9acbdd2aa1b5cb5209b.tar.gz rails-4687c86b91bc78834894a9acbdd2aa1b5cb5209b.tar.bz2 rails-4687c86b91bc78834894a9acbdd2aa1b5cb5209b.zip |
Include default storage configuration
Diffstat (limited to 'railties/lib/rails')
4 files changed, 35 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt index b75b65c8df..825c4ba061 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt @@ -26,6 +26,9 @@ Rails.application.configure do config.cache_store = :null_store end + + # Store uploaded files on the local file system (see config/storage_services.yml for options) + config.active_storage.service = :local <%- unless options.skip_action_mailer? -%> # Don't care if the mailer can't send. diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt index d44331a888..24888c082f 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt @@ -45,6 +45,8 @@ Rails.application.configure do # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + # Store uploaded files on the local file system (see config/storage_services.yml for options) + config.active_storage.service = :local <%- unless options[:skip_action_cable] -%> # Mount Action Cable outside main process or domain # config.action_cable.mount_path = nil diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt index 56416b3075..fdf16b4730 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt @@ -27,6 +27,9 @@ Rails.application.configure do # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + + # Store uploaded files on the local file system in a temporary directory + config.active_storage.service = :test <%- unless options.skip_action_mailer? -%> config.action_mailer.perform_caching = false diff --git a/railties/lib/rails/generators/rails/app/templates/config/storage_services.yml b/railties/lib/rails/generators/rails/app/templates/config/storage_services.yml new file mode 100644 index 0000000000..4ec2842145 --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/config/storage_services.yml @@ -0,0 +1,27 @@ +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 + +# mirror: +# service: Mirror +# primary: local +# secondaries: [ amazon, google ] |