cloudenvoy 0.1.0.dev → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +41 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +1 -0
- data/Appraisals +25 -0
- data/CHANGELOG.md +32 -0
- data/Gemfile.lock +215 -1
- data/README.md +581 -7
- data/app/controllers/cloudenvoy/application_controller.rb +8 -0
- data/app/controllers/cloudenvoy/subscriber_controller.rb +59 -0
- data/cloudenvoy.gemspec +15 -2
- data/config/routes.rb +5 -0
- data/examples/rails/.ruby-version +1 -0
- data/examples/rails/Gemfile +15 -0
- data/examples/rails/Gemfile.lock +207 -0
- data/examples/rails/Procfile +1 -0
- data/examples/rails/README.md +31 -0
- data/examples/rails/Rakefile +8 -0
- data/examples/rails/app/assets/config/manifest.js +2 -0
- data/examples/rails/app/assets/images/.keep +0 -0
- data/examples/rails/app/assets/stylesheets/application.css +15 -0
- data/examples/rails/app/channels/application_cable/channel.rb +6 -0
- data/examples/rails/app/channels/application_cable/connection.rb +6 -0
- data/examples/rails/app/controllers/application_controller.rb +4 -0
- data/examples/rails/app/controllers/concerns/.keep +0 -0
- data/examples/rails/app/helpers/application_helper.rb +4 -0
- data/examples/rails/app/javascript/packs/application.js +15 -0
- data/examples/rails/app/jobs/application_job.rb +9 -0
- data/examples/rails/app/mailers/application_mailer.rb +6 -0
- data/examples/rails/app/models/application_record.rb +5 -0
- data/examples/rails/app/models/concerns/.keep +0 -0
- data/examples/rails/app/publishers/hello_publisher.rb +34 -0
- data/examples/rails/app/subscribers/hello_subscriber.rb +16 -0
- data/examples/rails/app/views/layouts/application.html.erb +14 -0
- data/examples/rails/app/views/layouts/mailer.html.erb +13 -0
- data/examples/rails/app/views/layouts/mailer.text.erb +1 -0
- data/examples/rails/bin/rails +6 -0
- data/examples/rails/bin/rake +6 -0
- data/examples/rails/bin/setup +35 -0
- data/examples/rails/config.ru +7 -0
- data/examples/rails/config/application.rb +19 -0
- data/examples/rails/config/boot.rb +7 -0
- data/examples/rails/config/cable.yml +10 -0
- data/examples/rails/config/credentials.yml.enc +1 -0
- data/examples/rails/config/database.yml +25 -0
- data/examples/rails/config/environment.rb +7 -0
- data/examples/rails/config/environments/development.rb +65 -0
- data/examples/rails/config/environments/production.rb +114 -0
- data/examples/rails/config/environments/test.rb +50 -0
- data/examples/rails/config/initializers/application_controller_renderer.rb +9 -0
- data/examples/rails/config/initializers/assets.rb +14 -0
- data/examples/rails/config/initializers/backtrace_silencers.rb +8 -0
- data/examples/rails/config/initializers/cloudenvoy.rb +22 -0
- data/examples/rails/config/initializers/content_security_policy.rb +29 -0
- data/examples/rails/config/initializers/cookies_serializer.rb +7 -0
- data/examples/rails/config/initializers/filter_parameter_logging.rb +6 -0
- data/examples/rails/config/initializers/inflections.rb +17 -0
- data/examples/rails/config/initializers/mime_types.rb +5 -0
- data/examples/rails/config/initializers/wrap_parameters.rb +16 -0
- data/examples/rails/config/locales/en.yml +33 -0
- data/examples/rails/config/master.key +1 -0
- data/examples/rails/config/puma.rb +37 -0
- data/examples/rails/config/routes.rb +4 -0
- data/examples/rails/config/spring.rb +8 -0
- data/examples/rails/config/storage.yml +34 -0
- data/examples/rails/db/development.sqlite3 +0 -0
- data/examples/rails/db/test.sqlite3 +0 -0
- data/examples/rails/lib/assets/.keep +0 -0
- data/examples/rails/log/.keep +0 -0
- data/examples/rails/public/404.html +67 -0
- data/examples/rails/public/422.html +67 -0
- data/examples/rails/public/500.html +66 -0
- data/examples/rails/public/apple-touch-icon-precomposed.png +0 -0
- data/examples/rails/public/apple-touch-icon.png +0 -0
- data/examples/rails/public/favicon.ico +0 -0
- data/examples/rails/storage/.keep +0 -0
- data/gemfiles/rails_5.2.gemfile +7 -0
- data/gemfiles/rails_5.2.gemfile.lock +251 -0
- data/gemfiles/rails_6.0.gemfile +7 -0
- data/gemfiles/rails_6.0.gemfile.lock +267 -0
- data/gemfiles/semantic_logger_3.4.gemfile +7 -0
- data/gemfiles/semantic_logger_3.4.gemfile.lock +265 -0
- data/gemfiles/semantic_logger_4.6.gemfile +7 -0
- data/gemfiles/semantic_logger_4.6.gemfile.lock +265 -0
- data/gemfiles/semantic_logger_4.7.0.gemfile +7 -0
- data/gemfiles/semantic_logger_4.7.0.gemfile.lock +265 -0
- data/gemfiles/semantic_logger_4.7.2.gemfile +7 -0
- data/gemfiles/semantic_logger_4.7.2.gemfile.lock +265 -0
- data/lib/cloudenvoy.rb +96 -2
- data/lib/cloudenvoy/authentication_error.rb +6 -0
- data/lib/cloudenvoy/authenticator.rb +57 -0
- data/lib/cloudenvoy/backend/google_pub_sub.rb +146 -0
- data/lib/cloudenvoy/backend/memory_pub_sub.rb +89 -0
- data/lib/cloudenvoy/config.rb +165 -0
- data/lib/cloudenvoy/engine.rb +20 -0
- data/lib/cloudenvoy/invalid_subscriber_error.rb +6 -0
- data/lib/cloudenvoy/logger_wrapper.rb +167 -0
- data/lib/cloudenvoy/message.rb +96 -0
- data/lib/cloudenvoy/middleware/chain.rb +250 -0
- data/lib/cloudenvoy/pub_sub_client.rb +76 -0
- data/lib/cloudenvoy/publisher.rb +211 -0
- data/lib/cloudenvoy/publisher_logger.rb +32 -0
- data/lib/cloudenvoy/subscriber.rb +222 -0
- data/lib/cloudenvoy/subscriber_logger.rb +26 -0
- data/lib/cloudenvoy/subscription.rb +19 -0
- data/lib/cloudenvoy/testing.rb +106 -0
- data/lib/cloudenvoy/topic.rb +19 -0
- data/lib/cloudenvoy/version.rb +1 -1
- data/lib/tasks/cloudenvoy.rake +61 -0
- metadata +263 -6
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ApplicationJob < ActiveJob::Base
|
4
|
+
# Automatically retry jobs that encountered a deadlock
|
5
|
+
# retry_on ActiveRecord::Deadlocked
|
6
|
+
|
7
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
8
|
+
# discard_on ActiveJob::DeserializationError
|
9
|
+
end
|
File without changes
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class HelloPublisher
|
4
|
+
include Cloudenvoy::Publisher
|
5
|
+
|
6
|
+
cloudenvoy_options topic: 'hello-msgs'
|
7
|
+
|
8
|
+
#
|
9
|
+
# Set message metadata (attributes)
|
10
|
+
#
|
11
|
+
# @param [String] msg The message to publish
|
12
|
+
#
|
13
|
+
# @return [Hash] The message metadata
|
14
|
+
#
|
15
|
+
def metadata(msg)
|
16
|
+
{
|
17
|
+
kind: msg.start_with?('Hello') ? 'hello' : 'regular'
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# Format the payload.
|
23
|
+
#
|
24
|
+
# @param [String] msg The message to publish
|
25
|
+
#
|
26
|
+
# @return [Hash] The formatted message
|
27
|
+
#
|
28
|
+
def payload(msg)
|
29
|
+
{
|
30
|
+
type: 'message',
|
31
|
+
content: msg
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class HelloSubscriber
|
4
|
+
include Cloudenvoy::Subscriber
|
5
|
+
|
6
|
+
cloudenvoy_options topic: 'hello-msgs'
|
7
|
+
|
8
|
+
#
|
9
|
+
# Process a pub/sub message
|
10
|
+
#
|
11
|
+
# @param [Cloudenvoy::Message] message The message to process.
|
12
|
+
#
|
13
|
+
def process(message)
|
14
|
+
logger.info("Received message #{message.payload.dig('content')}")
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
FileUtils.chdir APP_ROOT do
|
14
|
+
# This script is a way to setup or update your development environment automatically.
|
15
|
+
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
|
16
|
+
# Add necessary setup steps to this file.
|
17
|
+
|
18
|
+
puts '== Installing dependencies =='
|
19
|
+
system! 'gem install bundler --conservative'
|
20
|
+
system('bundle check') || system!('bundle install')
|
21
|
+
|
22
|
+
# puts "\n== Copying sample files =="
|
23
|
+
# unless File.exist?('config/database.yml')
|
24
|
+
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
|
25
|
+
# end
|
26
|
+
|
27
|
+
puts "\n== Preparing database =="
|
28
|
+
system! 'bin/rails db:prepare'
|
29
|
+
|
30
|
+
puts "\n== Removing old logs and tempfiles =="
|
31
|
+
system! 'bin/rails log:clear tmp:clear'
|
32
|
+
|
33
|
+
puts "\n== Restarting application server =="
|
34
|
+
system! 'bin/rails restart'
|
35
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'boot'
|
4
|
+
|
5
|
+
require 'rails/all'
|
6
|
+
|
7
|
+
Bundler.require(*Rails.groups)
|
8
|
+
|
9
|
+
module Dummy
|
10
|
+
class Application < Rails::Application
|
11
|
+
# Initialize configuration defaults for originally generated Rails version.
|
12
|
+
config.load_defaults 6.0
|
13
|
+
|
14
|
+
# Settings in config/environments/* take precedence over those specified here.
|
15
|
+
# Application configuration can go into files in config/initializers
|
16
|
+
# -- all .rb files in that directory are automatically loaded after loading
|
17
|
+
# the framework and any gems in your application.
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Set up gems listed in the Gemfile.
|
4
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
|
5
|
+
|
6
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
7
|
+
$LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
|
@@ -0,0 +1 @@
|
|
1
|
+
jBUFm9LaktoqjLw7egZ/rqypP+0j0BrZyENZx2s4oGW9zhkrjGCUQvOPP6mL1LZlE1NeQX7yYwd4tM0KV4gBbSXcoLGZUD/KtWXg8ZMJraxBz3Klgt1SSoEDnKXbziqSPXXy0e4w9SqBflD9HAdg4hYj4I7m7utnrWctLB446Xn8LhApr/EPwmtLImRXVcLkY5fCQPrQ367lIbFxqX3vgQhadtZZnF6jpnD8R0m+QvhAJompM2jK3xZPilEG0TFZ5E/yd1Um+5PV+OFaM949zTR9mrINR+N6EzqzQg2oLoRJtXizEGyS399Lj8fL2yWj6fXvpeyGLbZEJRMECdWkoIfuRt5d+SRFEe39jprTTs1KNaMv5ajT5pzTQqb64W7dlBjw2oYRswfarDDuOv0eAWS1U7fTlQX3zgl8--yinJxK0UdO3VWhEq--NZjJhOTLbYEO+LqaGs60qg==
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite. Versions 3.8.0 and up are supported.
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/production.sqlite3
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Rails.application.configure do
|
4
|
+
$stdout.sync = true
|
5
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
6
|
+
|
7
|
+
# In the development environment your application's code is reloaded on
|
8
|
+
# every request. This slows down response time but is perfect for development
|
9
|
+
# since you don't have to restart the web server when you make code changes.
|
10
|
+
config.cache_classes = false
|
11
|
+
|
12
|
+
# Do not eager load code on boot.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Show full error reports.
|
16
|
+
config.consider_all_requests_local = true
|
17
|
+
|
18
|
+
# Enable/disable caching. By default caching is disabled.
|
19
|
+
# Run rails dev:cache to toggle caching.
|
20
|
+
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
21
|
+
config.action_controller.perform_caching = true
|
22
|
+
config.action_controller.enable_fragment_cache_logging = true
|
23
|
+
|
24
|
+
config.cache_store = :memory_store
|
25
|
+
config.public_file_server.headers = {
|
26
|
+
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
27
|
+
}
|
28
|
+
else
|
29
|
+
config.action_controller.perform_caching = false
|
30
|
+
|
31
|
+
config.cache_store = :null_store
|
32
|
+
end
|
33
|
+
|
34
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
35
|
+
config.active_storage.service = :local
|
36
|
+
|
37
|
+
# Don't care if the mailer can't send.
|
38
|
+
config.action_mailer.raise_delivery_errors = false
|
39
|
+
|
40
|
+
config.action_mailer.perform_caching = false
|
41
|
+
|
42
|
+
# Print deprecation notices to the Rails logger.
|
43
|
+
config.active_support.deprecation = :log
|
44
|
+
|
45
|
+
# Raise an error on page load if there are pending migrations.
|
46
|
+
config.active_record.migration_error = :page_load
|
47
|
+
|
48
|
+
# Highlight code that triggered database queries in logs.
|
49
|
+
config.active_record.verbose_query_logs = true
|
50
|
+
|
51
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
52
|
+
# This option may cause significant delays in view rendering with a large
|
53
|
+
# number of complex assets.
|
54
|
+
config.assets.debug = true
|
55
|
+
|
56
|
+
# Suppress logger output for asset requests.
|
57
|
+
config.assets.quiet = true
|
58
|
+
|
59
|
+
# Raises error for missing translations.
|
60
|
+
# config.action_view.raise_on_missing_translations = true
|
61
|
+
|
62
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
63
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
64
|
+
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
65
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Rails.application.configure do
|
4
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
+
|
6
|
+
# Code is not reloaded between requests.
|
7
|
+
config.cache_classes = true
|
8
|
+
|
9
|
+
# Eager load code on boot. This eager loads most of Rails and
|
10
|
+
# your application in memory, allowing both threaded web servers
|
11
|
+
# and those relying on copy on write to perform better.
|
12
|
+
# Rake tasks automatically ignore this option for performance.
|
13
|
+
config.eager_load = true
|
14
|
+
|
15
|
+
# Full error reports are disabled and caching is turned on.
|
16
|
+
config.consider_all_requests_local = false
|
17
|
+
config.action_controller.perform_caching = true
|
18
|
+
|
19
|
+
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
20
|
+
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
21
|
+
# config.require_master_key = true
|
22
|
+
|
23
|
+
# Disable serving static files from the `/public` folder by default since
|
24
|
+
# Apache or NGINX already handles this.
|
25
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
26
|
+
|
27
|
+
# Compress CSS using a preprocessor.
|
28
|
+
# config.assets.css_compressor = :sass
|
29
|
+
|
30
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
31
|
+
config.assets.compile = false
|
32
|
+
|
33
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
34
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
35
|
+
|
36
|
+
# Specifies the header that your server uses for sending files.
|
37
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
38
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
39
|
+
|
40
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
41
|
+
config.active_storage.service = :local
|
42
|
+
|
43
|
+
# Mount Action Cable outside main process or domain.
|
44
|
+
# config.action_cable.mount_path = nil
|
45
|
+
# config.action_cable.url = 'wss://example.com/cable'
|
46
|
+
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
47
|
+
|
48
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
49
|
+
# config.force_ssl = true
|
50
|
+
|
51
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
52
|
+
# when problems arise.
|
53
|
+
config.log_level = :debug
|
54
|
+
|
55
|
+
# Prepend all log lines with the following tags.
|
56
|
+
config.log_tags = [:request_id]
|
57
|
+
|
58
|
+
# Use a different cache store in production.
|
59
|
+
# config.cache_store = :mem_cache_store
|
60
|
+
|
61
|
+
# Use a real queuing backend for Active Job (and separate queues per environment).
|
62
|
+
# config.active_job.queue_adapter = :resque
|
63
|
+
# config.active_job.queue_name_prefix = "dummy_production"
|
64
|
+
|
65
|
+
config.action_mailer.perform_caching = false
|
66
|
+
|
67
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
68
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
69
|
+
# config.action_mailer.raise_delivery_errors = false
|
70
|
+
|
71
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
72
|
+
# the I18n.default_locale when a translation cannot be found).
|
73
|
+
config.i18n.fallbacks = true
|
74
|
+
|
75
|
+
# Send deprecation notices to registered listeners.
|
76
|
+
config.active_support.deprecation = :notify
|
77
|
+
|
78
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
79
|
+
config.log_formatter = ::Logger::Formatter.new
|
80
|
+
|
81
|
+
# Use a different logger for distributed setups.
|
82
|
+
# require 'syslog/logger'
|
83
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
84
|
+
|
85
|
+
if ENV['RAILS_LOG_TO_STDOUT'].present?
|
86
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
87
|
+
logger.formatter = config.log_formatter
|
88
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Do not dump schema after migrations.
|
92
|
+
config.active_record.dump_schema_after_migration = false
|
93
|
+
|
94
|
+
# Inserts middleware to perform automatic connection switching.
|
95
|
+
# The `database_selector` hash is used to pass options to the DatabaseSelector
|
96
|
+
# middleware. The `delay` is used to determine how long to wait after a write
|
97
|
+
# to send a subsequent read to the primary.
|
98
|
+
#
|
99
|
+
# The `database_resolver` class is used by the middleware to determine which
|
100
|
+
# database is appropriate to use based on the time delay.
|
101
|
+
#
|
102
|
+
# The `database_resolver_context` class is used by the middleware to set
|
103
|
+
# timestamps for the last write to the primary. The resolver uses the context
|
104
|
+
# class timestamps to determine how long to wait before reading from the
|
105
|
+
# replica.
|
106
|
+
#
|
107
|
+
# By default Rails will store a last write timestamp in the session. The
|
108
|
+
# DatabaseSelector middleware is designed as such you can define your own
|
109
|
+
# strategy for connection switching and pass that into the middleware through
|
110
|
+
# these configuration options.
|
111
|
+
# config.active_record.database_selector = { delay: 2.seconds }
|
112
|
+
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
|
113
|
+
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
|
114
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The test environment is used exclusively to run your application's
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
7
|
+
|
8
|
+
Rails.application.configure do
|
9
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
10
|
+
|
11
|
+
config.cache_classes = false
|
12
|
+
|
13
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
14
|
+
# just for the purpose of running a single test. If you are using a tool that
|
15
|
+
# preloads Rails for running tests, you may have to set it to true.
|
16
|
+
config.eager_load = false
|
17
|
+
|
18
|
+
# Configure public file server for tests with Cache-Control for performance.
|
19
|
+
config.public_file_server.enabled = true
|
20
|
+
config.public_file_server.headers = {
|
21
|
+
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
|
22
|
+
}
|
23
|
+
|
24
|
+
# Show full error reports and disable caching.
|
25
|
+
config.consider_all_requests_local = true
|
26
|
+
config.action_controller.perform_caching = false
|
27
|
+
config.cache_store = :null_store
|
28
|
+
|
29
|
+
# Raise exceptions instead of rendering exception templates.
|
30
|
+
config.action_dispatch.show_exceptions = false
|
31
|
+
|
32
|
+
# Disable request forgery protection in test environment.
|
33
|
+
config.action_controller.allow_forgery_protection = false
|
34
|
+
|
35
|
+
# Store uploaded files on the local file system in a temporary directory.
|
36
|
+
config.active_storage.service = :test
|
37
|
+
|
38
|
+
config.action_mailer.perform_caching = false
|
39
|
+
|
40
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
41
|
+
# The :test delivery method accumulates sent emails in the
|
42
|
+
# ActionMailer::Base.deliveries array.
|
43
|
+
config.action_mailer.delivery_method = :test
|
44
|
+
|
45
|
+
# Print deprecation notices to the stderr.
|
46
|
+
config.active_support.deprecation = :stderr
|
47
|
+
|
48
|
+
# Raises error for missing translations.
|
49
|
+
# config.action_view.raise_on_missing_translations = true
|
50
|
+
end
|