Skip to content

Commit 59151c1

Browse files
committed
fix: update development, production, and test environment configurations
- Set Amazon SQS as the active job queue adapter in development. - Change ActionMailer delivery method to SES and enable error reporting in development. - Adjust CORS settings for Action Cable in development. - Update file watcher to use EventedFileUpdateChecker in development. - Modify production settings to conditionally enable local request consideration based on the REVIEW_APP environment variable. - Enable public file server based on RAILS_SERVE_STATIC_FILES in production. - Comment out force_ssl in production for flexibility. - Set default_url_options for test and development environments to ensure proper URL generation. These changes enhance the configuration for local development and production environments, improving functionality and error handling.
1 parent 1b4b614 commit 59151c1

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

config/environments/development.rb

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,15 @@
3333
config.cache_store = :null_store
3434
end
3535

36+
config.active_job.queue_adapter = :amazon_sqs
37+
3638
# Store uploaded files on the local file system (see config/storage.yml for options).
3739
config.active_storage.service = :local
3840

3941
# Don't care if the mailer can't send.
40-
config.action_mailer.raise_delivery_errors = false
42+
config.action_mailer.delivery_method = :ses
43+
44+
config.action_mailer.raise_delivery_errors = true
4145

4246
config.action_mailer.perform_caching = false
4347
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
@@ -60,6 +64,16 @@
6064
# Highlight code that enqueued background job in logs.
6165
config.active_job.verbose_enqueue_logs = true
6266

67+
config.hosts << 'host.docker.internal'
68+
# config.action_cable.allowed_request_origins = [/http:\/\/*/, /https:\/\/*/]
69+
config.action_cable.allowed_request_origins = ['http://host.docker.internal:3000/*', 'http://localhost:8080', 'http://localhost:3001']
70+
71+
72+
# Debug mode disables concatenation and preprocessing of assets.
73+
# This option may cause significant delays in view rendering with a large
74+
# number of complex assets.
75+
config.assets.debug = true
76+
6377
# Suppress logger output for asset requests.
6478
config.assets.quiet = true
6579

@@ -75,7 +89,8 @@
7589
# Raise error when a before_action's only/except options reference missing actions
7690
config.action_controller.raise_on_missing_callback_actions = true
7791

78-
config.file_watcher = ActiveSupport::FileUpdateChecker
92+
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
93+
config.web_console.whitelisted_ips = '0.0.0.0/0' # 追記
7994
config.web_console.permissions = '0.0.0.0/0'
8095

8196
config.after_initialize do
@@ -85,3 +100,5 @@
85100
Bullet.rails_logger = true
86101
end
87102
end
103+
104+
Rails.application.routes.default_url_options[:host] = 'localhost:3000'

config/environments/production.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@
1313
config.eager_load = true
1414

1515
# Full error reports are disabled and caching is turned on.
16-
config.consider_all_requests_local = false
16+
if ENV['REVIEW_APP']
17+
config.consider_all_requests_local = true
18+
else
19+
config.consider_all_requests_local = false
20+
end
1721
config.action_controller.perform_caching = true
1822

1923
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
2024
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
2125
# config.require_master_key = true
2226

27+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
28+
2329
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
2430
# config.public_file_server.enabled = false
2531

@@ -49,7 +55,7 @@
4955
# config.assume_ssl = true
5056

5157
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
52-
config.force_ssl = true
58+
# config.force_ssl = true
5359

5460
# Log to STDOUT by default
5561
config.logger = ActiveSupport::Logger.new(STDOUT)

config/environments/test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,5 @@
6363
# Raise error when a before_action's only/except options reference missing actions
6464
config.action_controller.raise_on_missing_callback_actions = true
6565
end
66+
67+
Rails.application.routes.default_url_options[:host] = 'localhost:3000'

0 commit comments

Comments
 (0)