aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2017-07-31 15:57:37 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2017-07-31 15:57:37 -0500
commit90a8e0698db59d2f4ba137ea11c21783d6f9c66a (patch)
treec7e4f0683a3949808bad4daa1e4feafd31bc800c /railties/lib
parent54663f55efd93c5e4f649fd1ad2833a853261507 (diff)
downloadrails-90a8e0698db59d2f4ba137ea11c21783d6f9c66a.tar.gz
rails-90a8e0698db59d2f4ba137ea11c21783d6f9c66a.tar.bz2
rails-90a8e0698db59d2f4ba137ea11c21783d6f9c66a.zip
Use config/storage.yml as part of the skeleton and loading
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb11
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/storage.yml34
4 files changed, 44 insertions, 5 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index 507099ef57..dc7e243f7b 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -122,9 +122,10 @@ module Rails
def config_when_updating
cookie_serializer_config_exist = File.exist?("config/initializers/cookies_serializer.rb")
- action_cable_config_exist = File.exist?("config/cable.yml")
- rack_cors_config_exist = File.exist?("config/initializers/cors.rb")
- assets_config_exist = File.exist?("config/initializers/assets.rb")
+ action_cable_config_exist = File.exist?("config/cable.yml")
+ active_storage_config_exist = File.exist?("config/storage.yml")
+ rack_cors_config_exist = File.exist?("config/initializers/cors.rb")
+ assets_config_exist = File.exist?("config/initializers/assets.rb")
config
@@ -136,6 +137,10 @@ module Rails
template "config/cable.yml"
end
+ if !active_storage_config_exist
+ template "config/storage.yml"
+ end
+
unless rack_cors_config_exist
remove_file "config/initializers/cors.rb"
end
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 825c4ba061..d69769f631 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
@@ -27,7 +27,7 @@ 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)
+ # Store uploaded files on the local file system (see config/storage.yml for options)
config.active_storage.service = :local
<%- unless options.skip_action_mailer? -%>
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 24888c082f..5b16ada442 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,7 +45,7 @@ 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)
+ # Store uploaded files on the local file system (see config/storage.yml for options)
config.active_storage.service = :local
<%- unless options[:skip_action_cable] -%>
# Mount Action Cable outside main process or domain
diff --git a/railties/lib/rails/generators/rails/app/templates/config/storage.yml b/railties/lib/rails/generators/rails/app/templates/config/storage.yml
new file mode 100644
index 0000000000..90cd00d4a6
--- /dev/null
+++ b/railties/lib/rails/generators/rails/app/templates/config/storage.yml
@@ -0,0 +1,34 @@
+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.dig(:azure, :secret_access_key) %>
+# container: your_container_name
+
+# mirror:
+# service: Mirror
+# primary: local
+# mirrors: [ amazon, google, microsoft ]