redis_web_manager 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/.rspec +3 -0
- data/.rubocop.yml +17 -0
- data/.travis.yml +15 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +162 -0
- data/MIT-LICENSE +20 -0
- data/README.md +29 -0
- data/Rakefile +28 -0
- data/app/assets/config/redis_web_manager_manifest.js +2 -0
- data/app/assets/javascripts/redis_web_manager/application.js +19 -0
- data/app/assets/javascripts/redis_web_manager/bootstrap.js +6 -0
- data/app/assets/javascripts/redis_web_manager/chartjs.js +7 -0
- data/app/assets/javascripts/redis_web_manager/dashboard.js +246 -0
- data/app/assets/javascripts/redis_web_manager/jquery.js +2 -0
- data/app/assets/javascripts/redis_web_manager/keys.js +14 -0
- data/app/assets/javascripts/redis_web_manager/popper.js +4 -0
- data/app/assets/stylesheets/redis_web_manager/application.css +15 -0
- data/app/assets/stylesheets/redis_web_manager/bootstrap.css +6 -0
- data/app/assets/stylesheets/redis_web_manager/dashboard.css +28 -0
- data/app/controllers/redis_web_manager/actions_controller.rb +11 -0
- data/app/controllers/redis_web_manager/application_controller.rb +31 -0
- data/app/controllers/redis_web_manager/clients_controller.rb +12 -0
- data/app/controllers/redis_web_manager/configuration_controller.rb +12 -0
- data/app/controllers/redis_web_manager/dashboard_controller.rb +14 -0
- data/app/controllers/redis_web_manager/information_controller.rb +18 -0
- data/app/helpers/redis_web_manager/application_helper.rb +13 -0
- data/app/helpers/redis_web_manager/clients_helper.rb +35 -0
- data/app/helpers/redis_web_manager/dashboard_helper.rb +20 -0
- data/app/views/layouts/redis_web_manager/application.html.erb +17 -0
- data/app/views/redis_web_manager/clients/index.html.erb +58 -0
- data/app/views/redis_web_manager/configuration/index.html.erb +24 -0
- data/app/views/redis_web_manager/dashboard/index.html.erb +49 -0
- data/app/views/redis_web_manager/information/index.html.erb +24 -0
- data/app/views/redis_web_manager/shared/_header.html.erb +49 -0
- data/app/views/redis_web_manager/shared/_status.html.erb +6 -0
- data/bin/rails +20 -0
- data/config/routes.rb +19 -0
- data/gemfiles/Gemfile-5-2 +5 -0
- data/gemfiles/Gemfile-6-0 +5 -0
- data/lib/redis_web_manager.rb +35 -0
- data/lib/redis_web_manager/action.rb +21 -0
- data/lib/redis_web_manager/base.rb +11 -0
- data/lib/redis_web_manager/connection.rb +31 -0
- data/lib/redis_web_manager/data.rb +55 -0
- data/lib/redis_web_manager/engine.rb +21 -0
- data/lib/redis_web_manager/info.rb +69 -0
- data/lib/redis_web_manager/version.rb +5 -0
- data/redis_web_manager.gemspec +42 -0
- data/spec/controllers/redis_web_manager/actions_controller_spec.rb +13 -0
- data/spec/controllers/redis_web_manager/application_controller_spec.rb +29 -0
- data/spec/controllers/redis_web_manager/clients_controller_spec.rb +14 -0
- data/spec/controllers/redis_web_manager/configuration_controller_spec.rb +14 -0
- data/spec/controllers/redis_web_manager/dashboard_controller_spec.rb +14 -0
- data/spec/controllers/redis_web_manager/information_controller_spec.rb +14 -0
- data/spec/dummy/Rakefile +8 -0
- data/spec/dummy/app/assets/config/manifest.js +4 -0
- data/spec/dummy/app/assets/javascripts/application.js +14 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +4 -0
- data/spec/dummy/app/helpers/application_helper.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/bin/bundle +5 -0
- data/spec/dummy/bin/rails +6 -0
- data/spec/dummy/bin/rake +6 -0
- data/spec/dummy/bin/setup +27 -0
- data/spec/dummy/bin/update +27 -0
- data/spec/dummy/config.ru +7 -0
- data/spec/dummy/config/application.rb +23 -0
- data/spec/dummy/config/boot.rb +7 -0
- data/spec/dummy/config/environment.rb +7 -0
- data/spec/dummy/config/environments/development.rb +49 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +38 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +9 -0
- data/spec/dummy/config/initializers/assets.rb +14 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +8 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +26 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
- data/spec/dummy/config/initializers/inflections.rb +17 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +11 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/puma.rb +39 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/dummy/config/spring.rb +8 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/helpers/application_helper_spec.rb +15 -0
- data/spec/helpers/clients_helper_spec.rb +19 -0
- data/spec/helpers/dashboard_helper_spec.rb +15 -0
- data/spec/rails_helper.rb +50 -0
- data/spec/redis_web_manager_action_spec.rb +33 -0
- data/spec/redis_web_manager_connection_spec.rb +33 -0
- data/spec/redis_web_manager_info_spec.rb +90 -0
- data/spec/redis_web_manager_spec.rb +57 -0
- data/spec/routing/actions_controller_spec.rb +21 -0
- data/spec/routing/clients_controller_spec.rb +15 -0
- data/spec/routing/configuration_controller_spec.rb +15 -0
- data/spec/routing/dashboard_controller_spec.rb +15 -0
- data/spec/spec_helper.rb +96 -0
- metadata +619 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_helper'
|
4
|
+
|
5
|
+
RSpec.describe RedisWebManager::InformationController, type: :controller do
|
6
|
+
routes { RedisWebManager::Engine.routes }
|
7
|
+
|
8
|
+
describe 'GET #index' do
|
9
|
+
it 'returns a success response' do
|
10
|
+
get :index
|
11
|
+
expect(response).to be_successful
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
4
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
5
|
+
|
6
|
+
require_relative 'config/application'
|
7
|
+
|
8
|
+
Rails.application.load_tasks
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require rails-ujs
|
14
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
7
|
+
|
8
|
+
<%= stylesheet_link_tag 'application', media: 'all' %>
|
9
|
+
<%= javascript_include_tag 'application' %>
|
10
|
+
</head>
|
11
|
+
|
12
|
+
<body>
|
13
|
+
<%= yield %>
|
14
|
+
</body>
|
15
|
+
</html>
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'fileutils'
|
5
|
+
include FileUtils
|
6
|
+
|
7
|
+
# path to your application root.
|
8
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
9
|
+
|
10
|
+
def system!(*args)
|
11
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
12
|
+
end
|
13
|
+
|
14
|
+
chdir APP_ROOT do
|
15
|
+
# This script is a starting point to setup your application.
|
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== Removing old logs and tempfiles =="
|
23
|
+
system! 'bin/rails log:clear tmp:clear'
|
24
|
+
|
25
|
+
puts "\n== Restarting application server =="
|
26
|
+
system! 'bin/rails restart'
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'fileutils'
|
5
|
+
include FileUtils
|
6
|
+
|
7
|
+
# path to your application root.
|
8
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
9
|
+
|
10
|
+
def system!(*args)
|
11
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
12
|
+
end
|
13
|
+
|
14
|
+
chdir APP_ROOT do
|
15
|
+
# This script is a way to update your development environment automatically.
|
16
|
+
# Add necessary update 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== Removing old logs and tempfiles =="
|
23
|
+
system! 'bin/rails log:clear tmp:clear'
|
24
|
+
|
25
|
+
puts "\n== Restarting application server =="
|
26
|
+
system! 'bin/rails restart'
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'boot'
|
4
|
+
|
5
|
+
require 'rails'
|
6
|
+
require 'action_controller/railtie'
|
7
|
+
require 'action_view/railtie'
|
8
|
+
require 'sprockets/railtie'
|
9
|
+
|
10
|
+
Bundler.require(*Rails.groups)
|
11
|
+
require 'redis_web_manager'
|
12
|
+
|
13
|
+
module Dummy
|
14
|
+
class Application < Rails::Application
|
15
|
+
# Initialize configuration defaults for originally generated Rails version.
|
16
|
+
config.load_defaults 5.2
|
17
|
+
|
18
|
+
# Settings in config/environments/* take precedence over those specified here.
|
19
|
+
# Application configuration can go into files in config/initializers
|
20
|
+
# -- all .rb files in that directory are automatically loaded after loading
|
21
|
+
# the framework and any gems in your application.
|
22
|
+
end
|
23
|
+
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,49 @@
|
|
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
|
+
# In the development environment your application's code is reloaded on
|
7
|
+
# every request. This slows down response time but is perfect for development
|
8
|
+
# since you don't have to restart the web server when you make code changes.
|
9
|
+
config.cache_classes = false
|
10
|
+
|
11
|
+
# Do not eager load code on boot.
|
12
|
+
config.eager_load = false
|
13
|
+
|
14
|
+
# Show full error reports.
|
15
|
+
config.consider_all_requests_local = true
|
16
|
+
|
17
|
+
# Enable/disable caching. By default caching is disabled.
|
18
|
+
# Run rails dev:cache to toggle caching.
|
19
|
+
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
20
|
+
config.action_controller.perform_caching = true
|
21
|
+
|
22
|
+
config.cache_store = :memory_store
|
23
|
+
config.public_file_server.headers = {
|
24
|
+
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
25
|
+
}
|
26
|
+
else
|
27
|
+
config.action_controller.perform_caching = false
|
28
|
+
|
29
|
+
config.cache_store = :null_store
|
30
|
+
end
|
31
|
+
|
32
|
+
# Print deprecation notices to the Rails logger.
|
33
|
+
config.active_support.deprecation = :log
|
34
|
+
|
35
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
36
|
+
# This option may cause significant delays in view rendering with a large
|
37
|
+
# number of complex assets.
|
38
|
+
config.assets.debug = true
|
39
|
+
|
40
|
+
# Suppress logger output for asset requests.
|
41
|
+
config.assets.quiet = true
|
42
|
+
|
43
|
+
# Raises error for missing translations
|
44
|
+
# config.action_view.raise_on_missing_translations = true
|
45
|
+
|
46
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
47
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
48
|
+
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
49
|
+
end
|
@@ -0,0 +1,79 @@
|
|
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 JavaScripts and CSS.
|
28
|
+
config.assets.js_compressor = :uglifier
|
29
|
+
# config.assets.css_compressor = :sass
|
30
|
+
|
31
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
32
|
+
config.assets.compile = false
|
33
|
+
|
34
|
+
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
35
|
+
|
36
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
37
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
38
|
+
|
39
|
+
# Specifies the header that your server uses for sending files.
|
40
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
41
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
42
|
+
|
43
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
44
|
+
# config.force_ssl = true
|
45
|
+
|
46
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
47
|
+
# when problems arise.
|
48
|
+
config.log_level = :debug
|
49
|
+
|
50
|
+
# Prepend all log lines with the following tags.
|
51
|
+
config.log_tags = [:request_id]
|
52
|
+
|
53
|
+
# Use a different cache store in production.
|
54
|
+
# config.cache_store = :mem_cache_store
|
55
|
+
|
56
|
+
# Use a real queuing backend for Active Job (and separate queues per environment)
|
57
|
+
# config.active_job.queue_adapter = :resque
|
58
|
+
# config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
|
59
|
+
|
60
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
61
|
+
# the I18n.default_locale when a translation cannot be found).
|
62
|
+
config.i18n.fallbacks = true
|
63
|
+
|
64
|
+
# Send deprecation notices to registered listeners.
|
65
|
+
config.active_support.deprecation = :notify
|
66
|
+
|
67
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
68
|
+
config.log_formatter = ::Logger::Formatter.new
|
69
|
+
|
70
|
+
# Use a different logger for distributed setups.
|
71
|
+
# require 'syslog/logger'
|
72
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
73
|
+
|
74
|
+
if ENV['RAILS_LOG_TO_STDOUT'].present?
|
75
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
76
|
+
logger.formatter = config.log_formatter
|
77
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,38 @@
|
|
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
|
+
# 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
|
+
config.cache_classes = true
|
11
|
+
|
12
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
13
|
+
# just for the purpose of running a single test. If you are using a tool that
|
14
|
+
# preloads Rails for running tests, you may have to set it to true.
|
15
|
+
config.eager_load = false
|
16
|
+
|
17
|
+
# Configure public file server for tests with Cache-Control for performance.
|
18
|
+
config.public_file_server.enabled = true
|
19
|
+
config.public_file_server.headers = {
|
20
|
+
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
|
21
|
+
}
|
22
|
+
|
23
|
+
# Show full error reports and disable caching.
|
24
|
+
config.consider_all_requests_local = true
|
25
|
+
config.action_controller.perform_caching = false
|
26
|
+
|
27
|
+
# Raise exceptions instead of rendering exception templates.
|
28
|
+
config.action_dispatch.show_exceptions = false
|
29
|
+
|
30
|
+
# Disable request forgery protection in test environment.
|
31
|
+
config.action_controller.allow_forgery_protection = false
|
32
|
+
|
33
|
+
# Print deprecation notices to the stderr.
|
34
|
+
config.active_support.deprecation = :stderr
|
35
|
+
|
36
|
+
# Raises error for missing translations
|
37
|
+
# config.action_view.raise_on_missing_translations = true
|
38
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Be sure to restart your server when you modify this file.
|
4
|
+
|
5
|
+
# Version of your assets, change this if you want to expire all your assets.
|
6
|
+
Rails.application.config.assets.version = '1.0'
|
7
|
+
|
8
|
+
# Add additional assets to the asset load path.
|
9
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
10
|
+
|
11
|
+
# Precompile additional assets.
|
12
|
+
# application.js, application.css, and all non-JS/CSS in the app/assets
|
13
|
+
# folder are already added.
|
14
|
+
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Be sure to restart your server when you modify this file.
|
3
|
+
|
4
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
5
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
6
|
+
|
7
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
8
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Be sure to restart your server when you modify this file.
|
3
|
+
|
4
|
+
# Define an application-wide content security policy
|
5
|
+
# For further information see the following documentation
|
6
|
+
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
7
|
+
|
8
|
+
# Rails.application.config.content_security_policy do |policy|
|
9
|
+
# policy.default_src :self, :https
|
10
|
+
# policy.font_src :self, :https, :data
|
11
|
+
# policy.img_src :self, :https, :data
|
12
|
+
# policy.object_src :none
|
13
|
+
# policy.script_src :self, :https
|
14
|
+
# policy.style_src :self, :https
|
15
|
+
|
16
|
+
# # Specify URI for violation reports
|
17
|
+
# # policy.report_uri "/csp-violation-report-endpoint"
|
18
|
+
# end
|
19
|
+
|
20
|
+
# If you are using UJS then enable automatic nonce generation
|
21
|
+
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
|
22
|
+
|
23
|
+
# Report CSP violations to a specified URI
|
24
|
+
# For further information see the following documentation:
|
25
|
+
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
26
|
+
# Rails.application.config.content_security_policy_report_only = true
|