letter_opener_web 1.3.4 → 2.0.0.pre.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/brakeman-analysis.yml +46 -0
- data/.github/workflows/main.yml +34 -0
- data/.github/workflows/release-gem.yml +32 -0
- data/.gitignore +1 -0
- data/.rspec +1 -1
- data/.rubocop.yml +5 -16
- data/.rubocop_todo.yml +19 -0
- data/CHANGELOG.md +22 -1
- data/Gemfile +4 -0
- data/LICENSE.txt +1 -1
- data/README.md +33 -24
- data/app/controllers/letter_opener_web/application_controller.rb +1 -0
- data/app/controllers/letter_opener_web/letters_controller.rb +14 -7
- data/app/models/letter_opener_web/letter.rb +37 -5
- data/app/views/layouts/letter_opener_web/_javascripts.html.erb +31 -0
- data/app/views/layouts/letter_opener_web/_styles.html.erb +3 -0
- data/{vendor/assets/javascripts/letter_opener_web/favcount.js → app/views/layouts/letter_opener_web/js/_favcount.html.erb} +9 -7
- data/app/views/layouts/letter_opener_web/js/_jquery.html.erb +7 -0
- data/app/views/layouts/letter_opener_web/letters.html.erb +5 -3
- data/app/views/layouts/letter_opener_web/styles/_bootstrap.html.erb +9 -0
- data/app/views/layouts/letter_opener_web/styles/_icon.html.erb +2 -0
- data/app/views/layouts/letter_opener_web/styles/_letters.html.erb +70 -0
- data/app/views/letter_opener_web/letters/_item.html.erb +10 -0
- data/app/views/letter_opener_web/letters/index.html.erb +11 -46
- data/config/routes.rb +5 -5
- data/letter_opener_web.gemspec +19 -15
- data/lib/letter_opener_web/delivery_method.rb +1 -1
- data/lib/letter_opener_web/engine.rb +0 -10
- data/lib/letter_opener_web/version.rb +1 -1
- data/lib/letter_opener_web.rb +1 -0
- data/spec/controllers/letter_opener_web/letters_controller_spec.rb +22 -11
- data/spec/dummy/app/assets/config/manifest.js +0 -2
- data/spec/dummy/app/assets/stylesheets/application.css +0 -16
- data/spec/dummy/app/channels/application_cable/channel.rb +6 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +6 -0
- data/spec/dummy/app/controllers/application_controller.rb +0 -1
- data/spec/dummy/app/{assets/javascripts → javascript/packs}/application.js +2 -0
- data/spec/dummy/app/jobs/application_job.rb +9 -0
- data/spec/dummy/app/models/application_record.rb +5 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +4 -7
- data/spec/dummy/bin/rails +2 -4
- data/spec/dummy/bin/rake +2 -4
- data/spec/dummy/bin/setup +7 -10
- data/spec/dummy/config/application.rb +21 -7
- data/spec/dummy/config/environments/development.rb +44 -6
- data/spec/dummy/config/environments/production.rb +51 -14
- data/spec/dummy/config/environments/test.rb +30 -6
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -4
- data/spec/dummy/config/initializers/assets.rb +5 -5
- data/spec/dummy/config/initializers/backtrace_silencers.rb +5 -3
- data/spec/dummy/config/initializers/content_security_policy.rb +29 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +3 -1
- data/spec/dummy/config/initializers/permissions_policy.rb +12 -0
- data/spec/dummy/config/locales/en.yml +11 -1
- data/spec/dummy/config/puma.rb +18 -22
- data/spec/dummy/config/routes.rb +1 -4
- data/spec/dummy/config.ru +1 -0
- data/spec/dummy/public/404.html +6 -6
- data/spec/dummy/public/422.html +6 -6
- data/spec/dummy/public/500.html +6 -6
- data/spec/dummy/storage/.keep +0 -0
- data/spec/letter_opener_web_spec.rb +2 -2
- data/spec/models/letter_opener_web/letter_spec.rb +62 -17
- data/spec/spec_helper.rb +8 -0
- metadata +93 -56
- data/.travis.yml +0 -26
- data/app/assets/javascripts/letter_opener_web/application.js +0 -30
- data/app/assets/stylesheets/letter_opener_web/application.css.erb +0 -54
- data/bin/rails +0 -11
- data/spec/dummy/app/controllers/home_controller.rb +0 -10
- data/spec/dummy/app/mailers/contact_mailer.rb +0 -14
- data/spec/dummy/app/views/contact_mailer/new_message.html.erb +0 -21
- data/spec/dummy/app/views/contact_mailer/new_message.text.erb +0 -3
- data/spec/dummy/app/views/home/index.html.erb +0 -50
- data/spec/dummy/bin/bundle +0 -5
- data/spec/dummy/bin/update +0 -31
- data/spec/dummy/config/initializers/new_framework_defaults.rb +0 -10
- data/spec/dummy/config/initializers/session_store.rb +0 -5
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/config/spring.rb +0 -8
- data/vendor/assets/images/letter_opener_web/blue-dot.ico +0 -0
- data/vendor/assets/images/letter_opener_web/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/letter_opener_web/glyphicons-halflings.png +0 -0
- data/vendor/assets/javascripts/letter_opener_web/bootstrap.min.js +0 -6
- data/vendor/assets/javascripts/letter_opener_web/jquery-1.8.3.min.js +0 -2
- data/vendor/assets/javascripts/letter_opener_web/jquery_ujs.js +0 -429
- data/vendor/assets/stylesheets/letter_opener_web/bootstrap.min.css +0 -9
data/letter_opener_web.gemspec
CHANGED
@@ -5,26 +5,30 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require 'letter_opener_web/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |gem|
|
8
|
-
gem.name
|
9
|
-
gem.version
|
10
|
-
gem.authors
|
11
|
-
gem.email
|
12
|
-
gem.description
|
13
|
-
gem.summary
|
14
|
-
gem.homepage
|
15
|
-
gem.license
|
8
|
+
gem.name = 'letter_opener_web'
|
9
|
+
gem.version = LetterOpenerWeb::VERSION
|
10
|
+
gem.authors = ['Fabio Rehm', 'David Muto']
|
11
|
+
gem.email = ['fgrehm@gmail.com', 'david.muto@gmail.com']
|
12
|
+
gem.description = 'Gives letter_opener an interface for browsing sent emails'
|
13
|
+
gem.summary = gem.description
|
14
|
+
gem.homepage = 'https://github.com/fgrehm/letter_opener_web'
|
15
|
+
gem.license = 'MIT'
|
16
|
+
gem.required_ruby_version = '>= 2.7'
|
16
17
|
|
17
18
|
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
18
19
|
gem.executables = gem.files.grep(%r{^exe/}).map { |f| File.basename(f) }
|
19
20
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
20
21
|
gem.require_paths = ['lib']
|
21
22
|
|
22
|
-
gem.add_dependency 'actionmailer', '>=
|
23
|
-
gem.add_dependency 'letter_opener', '~> 1.
|
24
|
-
gem.add_dependency 'railties', '>=
|
23
|
+
gem.add_dependency 'actionmailer', '>= 5.2'
|
24
|
+
gem.add_dependency 'letter_opener', '~> 1.7'
|
25
|
+
gem.add_dependency 'railties', '>= 5.2'
|
26
|
+
gem.add_dependency 'rexml'
|
25
27
|
|
26
|
-
gem.add_development_dependency 'rails', '~>
|
27
|
-
gem.add_development_dependency 'rspec-rails', '~>
|
28
|
-
gem.add_development_dependency 'rubocop', '~>
|
29
|
-
gem.add_development_dependency '
|
28
|
+
gem.add_development_dependency 'rails', '~> 6.1'
|
29
|
+
gem.add_development_dependency 'rspec-rails', '~> 5.0'
|
30
|
+
gem.add_development_dependency 'rubocop', '~> 1.22'
|
31
|
+
gem.add_development_dependency 'rubocop-rails', '~> 2.12'
|
32
|
+
gem.add_development_dependency 'rubocop-rspec', '~> 2.5'
|
33
|
+
gem.add_development_dependency 'shoulda-matchers', '~> 5.0'
|
30
34
|
end
|
@@ -9,7 +9,7 @@ module LetterOpenerWeb
|
|
9
9
|
ENV['LAUNCHY_DRY_RUN'] = 'true'
|
10
10
|
|
11
11
|
super
|
12
|
-
rescue Launchy::CommandNotFoundError
|
12
|
+
rescue Launchy::CommandNotFoundError
|
13
13
|
# Ignore for non-executable Launchy environment.
|
14
14
|
ensure
|
15
15
|
ENV['LAUNCHY_DRY_RUN'] = original
|
@@ -16,15 +16,5 @@ module LetterOpenerWeb
|
|
16
16
|
)
|
17
17
|
end
|
18
18
|
end
|
19
|
-
|
20
|
-
initializer 'assets' do |_app|
|
21
|
-
Rails.application.config.assets.precompile += %w[
|
22
|
-
letter_opener_web/application.js
|
23
|
-
letter_opener_web/application.css
|
24
|
-
letter_opener_web/glyphicons-halflings.png
|
25
|
-
letter_opener_web/glyphicons-halflings-white.png
|
26
|
-
letter_opener_web/blue-dot.ico
|
27
|
-
]
|
28
|
-
end
|
29
19
|
end
|
30
20
|
end
|
data/lib/letter_opener_web.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'rails_helper'
|
4
4
|
|
5
|
-
describe LetterOpenerWeb::LettersController do
|
5
|
+
RSpec.describe LetterOpenerWeb::LettersController do
|
6
6
|
routes { LetterOpenerWeb::Engine.routes }
|
7
7
|
|
8
8
|
after(:each) { LetterOpenerWeb.reset! }
|
@@ -19,7 +19,7 @@ describe LetterOpenerWeb::LettersController do
|
|
19
19
|
|
20
20
|
it 'returns an HTML 200 response' do
|
21
21
|
expect(response.status).to eq(200)
|
22
|
-
expect(response.content_type).to eq('text/html')
|
22
|
+
expect(response.content_type).to eq('text/html; charset=utf-8')
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -32,13 +32,13 @@ describe LetterOpenerWeb::LettersController do
|
|
32
32
|
shared_examples 'found letter examples' do |letter_style|
|
33
33
|
before(:each) do
|
34
34
|
expect(LetterOpenerWeb::Letter).to receive(:find).with(id).and_return(letter)
|
35
|
-
expect(letter).to receive(:
|
36
|
-
get :show, id: id, style: letter_style
|
35
|
+
expect(letter).to receive(:valid?).and_return(true)
|
36
|
+
get :show, params: { id: id, style: letter_style }
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'renders an HTML 200 response' do
|
40
40
|
expect(response.status).to eq(200)
|
41
|
-
expect(response.content_type).to eq('text/html')
|
41
|
+
expect(response.content_type).to eq('text/html; charset=utf-8')
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -70,7 +70,7 @@ describe LetterOpenerWeb::LettersController do
|
|
70
70
|
|
71
71
|
context 'with wrong parameters' do
|
72
72
|
it 'should return 404 when invalid id given' do
|
73
|
-
get :show, id: id, style: 'rich'
|
73
|
+
get :show, params: { id: id, style: 'rich' }
|
74
74
|
expect(response.status).to eq(404)
|
75
75
|
end
|
76
76
|
end
|
@@ -84,12 +84,12 @@ describe LetterOpenerWeb::LettersController do
|
|
84
84
|
|
85
85
|
before do
|
86
86
|
allow(LetterOpenerWeb::Letter).to receive(:find).with(id).and_return(letter)
|
87
|
-
allow(letter).to receive(:
|
87
|
+
allow(letter).to receive(:valid?).and_return(true)
|
88
88
|
end
|
89
89
|
|
90
90
|
it 'sends the file as an inline attachment' do
|
91
91
|
allow(controller).to receive(:send_file) { controller.head :ok }
|
92
|
-
get :attachment, id: id, file: file_name.gsub(/\.\w+/, ''), format: File.extname(file_name)[1
|
92
|
+
get :attachment, params: { id: id, file: file_name.gsub(/\.\w+/, ''), format: File.extname(file_name)[1..] }
|
93
93
|
|
94
94
|
expect(response.status).to eq(200)
|
95
95
|
expect(controller).to have_received(:send_file)
|
@@ -97,7 +97,7 @@ describe LetterOpenerWeb::LettersController do
|
|
97
97
|
end
|
98
98
|
|
99
99
|
it "throws a 404 if attachment file can't be found" do
|
100
|
-
get :attachment, id: id, file: 'unknown', format: 'woot'
|
100
|
+
get :attachment, params: { id: id, file: 'unknown', format: 'woot' }
|
101
101
|
expect(response.status).to eq(404)
|
102
102
|
end
|
103
103
|
end
|
@@ -118,9 +118,20 @@ describe LetterOpenerWeb::LettersController do
|
|
118
118
|
let(:id) { 'an-id' }
|
119
119
|
|
120
120
|
it 'removes the selected letter' do
|
121
|
-
allow_any_instance_of(LetterOpenerWeb::Letter).to receive(:
|
121
|
+
allow_any_instance_of(LetterOpenerWeb::Letter).to receive(:valid?).and_return(true)
|
122
122
|
expect_any_instance_of(LetterOpenerWeb::Letter).to receive(:delete)
|
123
|
-
delete :destroy, id: id
|
123
|
+
delete :destroy, params: { id: id }
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'throws a 404 if attachment is outside of the letters base path' do
|
127
|
+
bad_id = '../an-id'
|
128
|
+
|
129
|
+
allow_any_instance_of(LetterOpenerWeb::Letter).to receive(:valid?).and_return(false)
|
130
|
+
expect_any_instance_of(LetterOpenerWeb::Letter).not_to receive(:delete)
|
131
|
+
|
132
|
+
delete :destroy, params: { id: bad_id }
|
133
|
+
|
134
|
+
expect(response.status).to eq(404)
|
124
135
|
end
|
125
136
|
end
|
126
137
|
end
|
@@ -13,19 +13,3 @@
|
|
13
13
|
*= require_tree .
|
14
14
|
*= require_self
|
15
15
|
*/
|
16
|
-
|
17
|
-
body {
|
18
|
-
padding-top: 20px;
|
19
|
-
}
|
20
|
-
|
21
|
-
.alert {
|
22
|
-
margin-top: 20px;
|
23
|
-
}
|
24
|
-
|
25
|
-
h1, .footer {
|
26
|
-
text-align: center;
|
27
|
-
}
|
28
|
-
|
29
|
-
.icon-white {
|
30
|
-
background-image: url(<%=asset_path "letter_opener_web/glyphicons-halflings-white.png"%>);
|
31
|
-
}
|
@@ -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
|
@@ -2,17 +2,14 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<title>Dummy</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
5
6
|
<%= csrf_meta_tags %>
|
7
|
+
<%= csp_meta_tag %>
|
6
8
|
|
7
|
-
<%= stylesheet_link_tag 'application', media: 'all'
|
8
|
-
<%= stylesheet_link_tag '//maxcdn.bootstrapcdn.com/bootstrap/2.3.2/css/bootstrap.min.css' %>
|
9
|
+
<%= stylesheet_link_tag 'application', media: 'all' %>
|
9
10
|
</head>
|
10
11
|
|
11
12
|
<body>
|
12
|
-
|
13
|
-
<%= yield %>
|
14
|
-
</div>
|
15
|
-
|
16
|
-
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
13
|
+
<%= yield %>
|
17
14
|
</body>
|
18
15
|
</html>
|
data/spec/dummy/bin/rails
CHANGED
data/spec/dummy/bin/rake
CHANGED
data/spec/dummy/bin/setup
CHANGED
@@ -1,19 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
4
|
-
require 'pathname'
|
5
|
-
require 'fileutils'
|
6
|
-
include FileUtils
|
2
|
+
require "fileutils"
|
7
3
|
|
8
4
|
# path to your application root.
|
9
|
-
APP_ROOT =
|
5
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
10
6
|
|
11
7
|
def system!(*args)
|
12
8
|
system(*args) || abort("\n== Command #{args} failed ==")
|
13
9
|
end
|
14
10
|
|
15
|
-
chdir APP_ROOT do
|
16
|
-
# This script is a
|
11
|
+
FileUtils.chdir APP_ROOT do
|
12
|
+
# This script is a way to set up or update your development environment automatically.
|
13
|
+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
17
14
|
# Add necessary setup steps to this file.
|
18
15
|
|
19
16
|
puts '== Installing dependencies =='
|
@@ -22,11 +19,11 @@ chdir APP_ROOT do
|
|
22
19
|
|
23
20
|
# puts "\n== Copying sample files =="
|
24
21
|
# unless File.exist?('config/database.yml')
|
25
|
-
# cp 'config/database.yml.sample', 'config/database.yml'
|
22
|
+
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
|
26
23
|
# end
|
27
24
|
|
28
25
|
puts "\n== Preparing database =="
|
29
|
-
system! 'bin/rails db:
|
26
|
+
system! 'bin/rails db:prepare'
|
30
27
|
|
31
28
|
puts "\n== Removing old logs and tempfiles =="
|
32
29
|
system! 'bin/rails log:clear tmp:clear'
|
@@ -2,22 +2,36 @@
|
|
2
2
|
|
3
3
|
require_relative 'boot'
|
4
4
|
|
5
|
-
require '
|
5
|
+
require 'rails'
|
6
|
+
# Pick the frameworks you want:
|
7
|
+
# require "active_model/railtie"
|
8
|
+
# require "active_job/railtie"
|
9
|
+
# require "active_record/railtie"
|
10
|
+
# require "active_storage/engine"
|
6
11
|
require 'action_controller/railtie'
|
7
12
|
require 'action_mailer/railtie'
|
13
|
+
# require "action_mailbox/engine"
|
14
|
+
# require "action_text/engine"
|
8
15
|
require 'action_view/railtie'
|
9
|
-
require
|
10
|
-
require
|
16
|
+
# require "action_cable/engine"
|
17
|
+
# require "sprockets/railtie"
|
18
|
+
# require "rails/test_unit/railtie"
|
11
19
|
|
20
|
+
# Require the gems listed in Gemfile, including any gems
|
21
|
+
# you've limited to :test, :development, or :production.
|
12
22
|
Bundler.require(*Rails.groups)
|
13
23
|
require 'letter_opener_web'
|
14
24
|
|
15
25
|
module Dummy
|
16
26
|
class Application < Rails::Application
|
17
|
-
|
18
|
-
# Application configuration should go into files in config/initializers
|
19
|
-
# -- all .rb files in that directory are automatically loaded.
|
27
|
+
config.load_defaults Rails::VERSION::STRING.to_f
|
20
28
|
|
21
|
-
|
29
|
+
# Configuration for the application, engines, and railties goes here.
|
30
|
+
#
|
31
|
+
# These settings can be overridden in specific environments using the files
|
32
|
+
# in config/environments, which are processed later.
|
33
|
+
#
|
34
|
+
# config.time_zone = "Central Time (US & Canada)"
|
35
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
22
36
|
end
|
23
37
|
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'active_support/core_ext/integer/time'
|
4
|
+
|
3
5
|
Rails.application.configure do
|
4
6
|
# Settings specified here will take precedence over those in config/application.rb.
|
5
7
|
|
6
|
-
# In the development environment your application's code is reloaded
|
7
|
-
#
|
8
|
+
# In the development environment your application's code is reloaded any time
|
9
|
+
# it changes. This slows down response time but is perfect for development
|
8
10
|
# since you don't have to restart the web server when you make code changes.
|
9
11
|
config.cache_classes = false
|
10
12
|
|
@@ -14,15 +16,45 @@ Rails.application.configure do
|
|
14
16
|
# Show full error reports.
|
15
17
|
config.consider_all_requests_local = true
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
# Enable/disable caching. By default caching is disabled.
|
20
|
+
# Run rails dev:cache to toggle caching.
|
21
|
+
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
22
|
+
config.action_controller.perform_caching = true
|
23
|
+
config.action_controller.enable_fragment_cache_logging = true
|
24
|
+
|
25
|
+
config.cache_store = :memory_store
|
26
|
+
config.public_file_server.headers = {
|
27
|
+
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
28
|
+
}
|
29
|
+
else
|
30
|
+
config.action_controller.perform_caching = false
|
31
|
+
|
32
|
+
config.cache_store = :null_store
|
33
|
+
end
|
34
|
+
|
35
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
36
|
+
# config.active_storage.service = :local
|
19
37
|
|
20
38
|
# Don't care if the mailer can't send.
|
21
39
|
config.action_mailer.raise_delivery_errors = false
|
22
40
|
|
41
|
+
config.action_mailer.perform_caching = false
|
42
|
+
|
23
43
|
# Print deprecation notices to the Rails logger.
|
24
44
|
config.active_support.deprecation = :log
|
25
45
|
|
46
|
+
# Raise exceptions for disallowed deprecations.
|
47
|
+
config.active_support.disallowed_deprecation = :raise
|
48
|
+
|
49
|
+
# Tell Active Support which deprecation messages to disallow.
|
50
|
+
config.active_support.disallowed_deprecation_warnings = []
|
51
|
+
|
52
|
+
# Raise an error on page load if there are pending migrations.
|
53
|
+
# config.active_record.migration_error = :page_load
|
54
|
+
|
55
|
+
# Highlight code that triggered database queries in logs.
|
56
|
+
# config.active_record.verbose_query_logs = true
|
57
|
+
|
26
58
|
# Debug mode disables concatenation and preprocessing of assets.
|
27
59
|
# This option may cause significant delays in view rendering with a large
|
28
60
|
# number of complex assets.
|
@@ -31,10 +63,16 @@ Rails.application.configure do
|
|
31
63
|
# Suppress logger output for asset requests.
|
32
64
|
config.assets.quiet = true
|
33
65
|
|
34
|
-
# Raises error for missing translations
|
35
|
-
# config.
|
66
|
+
# Raises error for missing translations.
|
67
|
+
# config.i18n.raise_on_missing_translations = true
|
68
|
+
|
69
|
+
# Annotate rendered view with file names.
|
70
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
36
71
|
|
37
72
|
# Use an evented file watcher to asynchronously detect changes in source code,
|
38
73
|
# routes, locales, etc. This feature depends on the listen gem.
|
39
74
|
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
75
|
+
|
76
|
+
# Uncomment if you wish to allow Action Cable access from any origin.
|
77
|
+
# config.action_cable.disable_request_forgery_protection = true
|
40
78
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'active_support/core_ext/integer/time'
|
4
|
+
|
3
5
|
Rails.application.configure do
|
4
6
|
# Settings specified here will take precedence over those in config/application.rb.
|
5
7
|
|
@@ -16,27 +18,31 @@ Rails.application.configure do
|
|
16
18
|
config.consider_all_requests_local = false
|
17
19
|
config.action_controller.perform_caching = true
|
18
20
|
|
21
|
+
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
22
|
+
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
23
|
+
# config.require_master_key = true
|
24
|
+
|
19
25
|
# Disable serving static files from the `/public` folder by default since
|
20
26
|
# Apache or NGINX already handles this.
|
21
27
|
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
22
28
|
|
23
|
-
# Compress
|
24
|
-
config.assets.js_compressor = :uglifier
|
29
|
+
# Compress CSS using a preprocessor.
|
25
30
|
# config.assets.css_compressor = :sass
|
26
31
|
|
27
32
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
28
33
|
config.assets.compile = false
|
29
34
|
|
30
|
-
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
31
|
-
|
32
35
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
33
|
-
# config.
|
36
|
+
# config.asset_host = 'http://assets.example.com'
|
34
37
|
|
35
38
|
# Specifies the header that your server uses for sending files.
|
36
39
|
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
37
40
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
38
41
|
|
39
|
-
#
|
42
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
43
|
+
# config.active_storage.service = :local
|
44
|
+
|
45
|
+
# Mount Action Cable outside main process or domain.
|
40
46
|
# config.action_cable.mount_path = nil
|
41
47
|
# config.action_cable.url = 'wss://example.com/cable'
|
42
48
|
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
@@ -44,9 +50,9 @@ Rails.application.configure do
|
|
44
50
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
45
51
|
# config.force_ssl = true
|
46
52
|
|
47
|
-
#
|
48
|
-
#
|
49
|
-
config.log_level = :
|
53
|
+
# Include generic and useful information about system operation, but avoid logging too much
|
54
|
+
# information to avoid inadvertent exposure of personally identifiable information (PII).
|
55
|
+
config.log_level = :info
|
50
56
|
|
51
57
|
# Prepend all log lines with the following tags.
|
52
58
|
config.log_tags = [:request_id]
|
@@ -54,9 +60,10 @@ Rails.application.configure do
|
|
54
60
|
# Use a different cache store in production.
|
55
61
|
# config.cache_store = :mem_cache_store
|
56
62
|
|
57
|
-
# Use a real queuing backend for Active Job (and separate queues per environment)
|
63
|
+
# Use a real queuing backend for Active Job (and separate queues per environment).
|
58
64
|
# config.active_job.queue_adapter = :resque
|
59
|
-
# config.active_job.queue_name_prefix = "
|
65
|
+
# config.active_job.queue_name_prefix = "dummy_production"
|
66
|
+
|
60
67
|
config.action_mailer.perform_caching = false
|
61
68
|
|
62
69
|
# Ignore bad email addresses and do not raise email delivery errors.
|
@@ -70,16 +77,46 @@ Rails.application.configure do
|
|
70
77
|
# Send deprecation notices to registered listeners.
|
71
78
|
config.active_support.deprecation = :notify
|
72
79
|
|
80
|
+
# Log disallowed deprecations.
|
81
|
+
config.active_support.disallowed_deprecation = :log
|
82
|
+
|
83
|
+
# Tell Active Support which deprecation messages to disallow.
|
84
|
+
config.active_support.disallowed_deprecation_warnings = []
|
85
|
+
|
73
86
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
74
87
|
config.log_formatter = ::Logger::Formatter.new
|
75
88
|
|
76
89
|
# Use a different logger for distributed setups.
|
77
|
-
# require
|
90
|
+
# require "syslog/logger"
|
78
91
|
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
79
92
|
|
80
93
|
if ENV['RAILS_LOG_TO_STDOUT'].present?
|
81
|
-
logger = ActiveSupport::Logger.new(
|
94
|
+
logger = ActiveSupport::Logger.new($stdout)
|
82
95
|
logger.formatter = config.log_formatter
|
83
|
-
config.logger
|
96
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
84
97
|
end
|
98
|
+
|
99
|
+
# Do not dump schema after migrations.
|
100
|
+
# config.active_record.dump_schema_after_migration = false
|
101
|
+
|
102
|
+
# Inserts middleware to perform automatic connection switching.
|
103
|
+
# The `database_selector` hash is used to pass options to the DatabaseSelector
|
104
|
+
# middleware. The `delay` is used to determine how long to wait after a write
|
105
|
+
# to send a subsequent read to the primary.
|
106
|
+
#
|
107
|
+
# The `database_resolver` class is used by the middleware to determine which
|
108
|
+
# database is appropriate to use based on the time delay.
|
109
|
+
#
|
110
|
+
# The `database_resolver_context` class is used by the middleware to set
|
111
|
+
# timestamps for the last write to the primary. The resolver uses the context
|
112
|
+
# class timestamps to determine how long to wait before reading from the
|
113
|
+
# replica.
|
114
|
+
#
|
115
|
+
# By default Rails will store a last write timestamp in the session. The
|
116
|
+
# DatabaseSelector middleware is designed as such you can define your own
|
117
|
+
# strategy for connection switching and pass that into the middleware through
|
118
|
+
# these configuration options.
|
119
|
+
# config.active_record.database_selector = { delay: 2.seconds }
|
120
|
+
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
|
121
|
+
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
|
85
122
|
end
|
@@ -1,12 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'active_support/core_ext/integer/time'
|
4
|
+
|
5
|
+
# The test environment is used exclusively to run your application's
|
6
|
+
# test suite. You never need to work with it otherwise. Remember that
|
7
|
+
# your test database is "scratch space" for the test suite and is wiped
|
8
|
+
# and recreated between test runs. Don't rely on the data there!
|
9
|
+
|
3
10
|
Rails.application.configure do
|
4
11
|
# Settings specified here will take precedence over those in config/application.rb.
|
5
12
|
|
6
|
-
# The test environment is used exclusively to run your application's
|
7
|
-
# test suite. You never need to work with it otherwise. Remember that
|
8
|
-
# your test database is "scratch space" for the test suite and is wiped
|
9
|
-
# and recreated between test runs. Don't rely on the data there!
|
10
13
|
config.cache_classes = true
|
11
14
|
|
12
15
|
# Do not eager load code on boot. This avoids loading your whole application
|
@@ -14,9 +17,16 @@ Rails.application.configure do
|
|
14
17
|
# preloads Rails for running tests, you may have to set it to true.
|
15
18
|
config.eager_load = false
|
16
19
|
|
20
|
+
# Configure public file server for tests with Cache-Control for performance.
|
21
|
+
config.public_file_server.enabled = true
|
22
|
+
config.public_file_server.headers = {
|
23
|
+
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
|
24
|
+
}
|
25
|
+
|
17
26
|
# Show full error reports and disable caching.
|
18
27
|
config.consider_all_requests_local = true
|
19
28
|
config.action_controller.perform_caching = false
|
29
|
+
config.cache_store = :null_store
|
20
30
|
|
21
31
|
# Raise exceptions instead of rendering exception templates.
|
22
32
|
config.action_dispatch.show_exceptions = false
|
@@ -24,6 +34,11 @@ Rails.application.configure do
|
|
24
34
|
# Disable request forgery protection in test environment.
|
25
35
|
config.action_controller.allow_forgery_protection = false
|
26
36
|
|
37
|
+
# Store uploaded files on the local file system in a temporary directory.
|
38
|
+
# config.active_storage.service = :test
|
39
|
+
|
40
|
+
config.action_mailer.perform_caching = false
|
41
|
+
|
27
42
|
# Tell Action Mailer not to deliver emails to the real world.
|
28
43
|
# The :test delivery method accumulates sent emails in the
|
29
44
|
# ActionMailer::Base.deliveries array.
|
@@ -32,6 +47,15 @@ Rails.application.configure do
|
|
32
47
|
# Print deprecation notices to the stderr.
|
33
48
|
config.active_support.deprecation = :stderr
|
34
49
|
|
35
|
-
#
|
36
|
-
|
50
|
+
# Raise exceptions for disallowed deprecations.
|
51
|
+
config.active_support.disallowed_deprecation = :raise
|
52
|
+
|
53
|
+
# Tell Active Support which deprecation messages to disallow.
|
54
|
+
config.active_support.disallowed_deprecation_warnings = []
|
55
|
+
|
56
|
+
# Raises error for missing translations.
|
57
|
+
# config.i18n.raise_on_missing_translations = true
|
58
|
+
|
59
|
+
# Annotate rendered view with file names.
|
60
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
37
61
|
end
|