about summary refs log tree commit diff stats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/application.rb3
-rw-r--r--config/boot.rb4
-rw-r--r--config/credentials.yml.enc1
-rw-r--r--config/credentials/production.yml.enc1
-rw-r--r--config/database.yml31
-rw-r--r--config/deploy.rb8
-rw-r--r--config/deploy/production.rb2
-rw-r--r--config/environment.rb2
-rw-r--r--config/environments/development.rb43
-rw-r--r--config/environments/production.rb14
-rw-r--r--config/environments/test.rb40
-rw-r--r--config/initializers/akismet.rb2
-rw-r--r--config/initializers/assets.rb3
-rw-r--r--config/initializers/ckeditor.rb58
-rw-r--r--config/initializers/content_security_policy.rb25
-rw-r--r--config/initializers/filter_parameter_logging.rb8
-rw-r--r--config/initializers/inflections.rb8
-rw-r--r--config/initializers/js_routes.rb7
-rw-r--r--config/initializers/new_framework_defaults_7_0.rb135
-rw-r--r--config/initializers/permissions_policy.rb11
-rw-r--r--config/initializers/recaptcha.rb4
-rw-r--r--config/initializers/yaml_serialization.rb1
-rw-r--r--config/mail.yml8
-rw-r--r--config/routes.rb69
-rw-r--r--config/schedule.rb27
-rw-r--r--config/secrets.yml32
-rw-r--r--config/storage.yml34
27 files changed, 437 insertions, 144 deletions
diff --git a/config/application.rb b/config/application.rb index 485c3a3..e855cbf 100644 --- a/config/application.rb +++ b/config/application.rb
@@ -9,10 +9,11 @@ Bundler.require(*Rails.groups)
9module Thoughts 9module Thoughts
10 class Application < Rails::Application 10 class Application < Rails::Application
11 # Initialize configuration defaults for originally generated Rails version. 11 # Initialize configuration defaults for originally generated Rails version.
12 config.load_defaults 5.1 12 config.load_defaults Rails::VERSION::STRING.to_f
13 13
14 # Settings in config/environments/* take precedence over those specified here. 14 # Settings in config/environments/* take precedence over those specified here.
15 # Application configuration should go into files in config/initializers 15 # Application configuration should go into files in config/initializers
16 # -- all .rb files in that directory are automatically loaded. 16 # -- all .rb files in that directory are automatically loaded.
17 config.time_zone = "Eastern Time (US & Canada)"
17 end 18 end
18end 19end
diff --git a/config/boot.rb b/config/boot.rb index 30f5120..2820116 100644 --- a/config/boot.rb +++ b/config/boot.rb
@@ -1,3 +1,3 @@
1ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 1ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
2 2
3require 'bundler/setup' # Set up gems listed in the Gemfile. 3require "bundler/setup" # Set up gems listed in the Gemfile.
diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc new file mode 100644 index 0000000..e08912f --- /dev/null +++ b/config/credentials.yml.enc
@@ -0,0 +1 @@
MTHDW1ZOa9otC2lb9iG3bKlhzM8WgEoJddmcsv22b7TEv+ZxlnjBvql1MGJjfo+tNl9dT4gqUOH41Q2WfRhwIokibD6cLMKl8z3VPLHdARR3HW4OzEJoLYXYB5ycLtSFmL3jq/TkMBkctRvPo7jeGGBwtEHvh1tBx6cGr/fEvzWMKYMUPiugaMN3OPExZ5VaD1sCHTMm7erwP06+8KTABwGfF6quthHctj/39RusmAWaObVsUwm70nqij+/qekJEZS3xYEuCDZlKqQvwC7Z+qJlmO8vj8CYNFq80bD9MiuEL0kiTVp22ZyMj2TY6YXy2jabkVx5c7FVytx/+kbaNdGtLYqvvuqDXodcai18OWUhR3r+tzPqcinggWmzZeJ0O54dE7Srpe3wGFH3xmgXHRa1jczmCDwlGRTqmjX7E6CBiP7u5NAKLeALvADWGocJwUi0r8r6E3/a8rpsaL97JCjL1GNCDlRSAapqHafzszDWN31yG5mLc9OUoE2RJjU7bgohrhoAPyHpetRxO7fBpZ0quNAh1awiTXVTcNUlDT+UPkQi1mvQo47G3CM9OG8hlgKtfkMMKsl9D92k/g7zIyJzLsPKqYnxHj+qcnU0939xJ0x4MnUPam1oq7OF2FtBgU/OCDxMuM//qSI2Q4+RRKRHs/NLdADxRgO3WJZ+oe2r9YBfTYTlbdOEKmCxSrQMzpB/1jq0jSTRYynn/GO0Z1Pjx0wVzH8vjVosXfh6/PaKslMdHbOM=--A5y7uJSVaL0539+f--FP9Oigql2/EdcYszZ6hj/A== \ No newline at end of file
diff --git a/config/credentials/production.yml.enc b/config/credentials/production.yml.enc new file mode 100644 index 0000000..6359cc9 --- /dev/null +++ b/config/credentials/production.yml.enc
@@ -0,0 +1 @@
uzTsEcFmu5QyOod1jjNQT8pqdQ9Tq8+OuH5qOulURR+Ew3+DBAN9/kYZ0b5OBcxnNGlN3suMC6fpgev4fYoaucCufXgNVAhhl1Lch9SJ2jo/1jCIS1U6mTPmwbF1aWM/P7jJhw8535RdlzohVStrIO0Rn3ygshVFFPODSccqyIhDbiiK5j0bvErzt5fDN091SIB0pdtxzy/XBwwfcQ6EaTg170Pv1mmIyCSWD1AGyzGlRhFVYhyv3sEabsC1dfYXjyZYrpbhvfZbi46TzeNA4kPLIVfVNiW0QoJtT90UqpOLcnQKwf23WIxPemzsT9iQj0/pEci+umHG6MkH2zE1eBOlj2VdopBqVEwQEgDvqt6zQMKAbLPU1E3VM94gCxeTidwIMoFGhSXl6nlGwI9ozBXvKyFNgMiz9UKtjEXcQOG3cIBxxMEQ+sjGEu3vAMvD7OymSGSC81JCbcdOqHWH/iIh2K3IcGyibJ4ScVsUBMn7lnsMEPrQQEJ/Df0X2mplJc0i8n19H1S7SrLKSaO7FDENPC0d1dN5nnOt5nDGU2/qkiGJ+LepX/Gb3cxc0fpcnC359rB5WCTKsxBOzjqW5IapCRSa0ztZz+xeXUBN4sDRUzPun2yCqaCxe+ptzTxzT+Ej9oMKSJJncc/zUuwRmd6KbnyQ3/ISeNNIC0BLWaohaj3lP/tRkLkcBNqu/MA4pxUxs1Lwu/8gW9d4GrrxCxOSsQnDk5VzF80LCk4oq+BVrjPYY0vWzVxtj+56slIoUIBIUWRjFTbBuyr3gejPjis5NwiFMyi8emH+a9aa3Ge44YnrDSAA+JVzqHSAF8erIuiqgaTAFwprSmED8pIIV2A0/WWrPcuI5xaAv4e2bQWfzM3SujvY--rs7RvQb911E+dh50--fCsEmvYD6LcaB6ReBcHGrA== \ No newline at end of file
diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 0000000..78f158b --- /dev/null +++ b/config/database.yml
@@ -0,0 +1,31 @@
1# SQLite version 3.x
2# gem install sqlite3
3#
4# Ensure the SQLite 3 gem is defined in your Gemfile
5# gem 'sqlite3'
6#
7default: &default
8 adapter: sqlite3
9 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10 timeout: 5000
11
12development:
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.
19test:
20 <<: *default
21 database: db/test.sqlite3
22
23production:
24 adapter: mysql2
25 encoding: utf8mb4
26 database: thoughts
27 pool: 5
28 username: thoughts
29 password: <%= Rails.application.credentials.database_password %>
30 collation: utf8mb4_bin
31 socket: /var/run/mysqld/mysqld.sock
diff --git a/config/deploy.rb b/config/deploy.rb index ade184f..de297e3 100644 --- a/config/deploy.rb +++ b/config/deploy.rb
@@ -1,8 +1,8 @@
1# config valid only for current version of Capistrano 1# config valid only for current version of Capistrano
2lock "3.11.0" 2lock "3.19.2"
3 3
4set :application, "thoughts" 4set :application, "thoughts"
5set :repo_url, "git@github.com:hatkirby/thoughts.git" 5set :repo_url, "/srv/git/thoughts"
6 6
7# Default branch is :master 7# Default branch is :master
8# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp 8# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
@@ -21,10 +21,10 @@ set :deploy_to, "/srv/www/thoughts"
21# set :pty, true 21# set :pty, true
22 22
23# Default value for :linked_files is [] 23# Default value for :linked_files is []
24append :linked_files, "config/database.yml", "config/secrets.yml" 24append :linked_files, "config/master.key", "config/credentials/production.key"
25 25
26# Default value for linked_dirs is [] 26# Default value for linked_dirs is []
27append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/uploads" 27append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/uploads", "storage"
28 28
29# Default value for default_env is {} 29# Default value for default_env is {}
30# set :default_env, { path: "/opt/ruby/bin:$PATH" } 30# set :default_env, { path: "/opt/ruby/bin:$PATH" }
diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 6475c07..7f42225 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb
@@ -6,7 +6,7 @@
6# server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value 6# server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value
7# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value 7# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value
8# server "db.example.com", user: "deploy", roles: %w{db} 8# server "db.example.com", user: "deploy", roles: %w{db}
9server "feffernoo.se", user: "thoughts", roles: %w{app db web} 9server "fourisland.com", user: "thoughts", roles: %w{app db web}
10 10
11 11
12 12
diff --git a/config/environment.rb b/config/environment.rb index 426333b..cac5315 100644 --- a/config/environment.rb +++ b/config/environment.rb
@@ -1,5 +1,5 @@
1# Load the Rails application. 1# Load the Rails application.
2require_relative 'application' 2require_relative "application"
3 3
4# Initialize the Rails application. 4# Initialize the Rails application.
5Rails.application.initialize! 5Rails.application.initialize!
diff --git a/config/environments/development.rb b/config/environments/development.rb index 1b0c4b3..e683ebb 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb
@@ -1,8 +1,10 @@
1require "active_support/core_ext/integer/time"
2
1Rails.application.configure do 3Rails.application.configure do
2 # Settings specified here will take precedence over those in config/application.rb. 4 # Settings specified here will take precedence over those in config/application.rb.
3 5
4 # In the development environment your application's code is reloaded on 6 # In the development environment your application's code is reloaded any time
5 # every request. This slows down response time but is perfect for development 7 # it changes. This slows down response time but is perfect for development
6 # since you don't have to restart the web server when you make code changes. 8 # since you don't have to restart the web server when you make code changes.
7 config.cache_classes = false 9 config.cache_classes = false
8 10
@@ -12,13 +14,18 @@ Rails.application.configure do
12 # Show full error reports. 14 # Show full error reports.
13 config.consider_all_requests_local = true 15 config.consider_all_requests_local = true
14 16
17 # Enable server timing
18 config.server_timing = true
19
15 # Enable/disable caching. By default caching is disabled. 20 # Enable/disable caching. By default caching is disabled.
16 if Rails.root.join('tmp/caching-dev.txt').exist? 21 # Run rails dev:cache to toggle caching.
22 if Rails.root.join("tmp/caching-dev.txt").exist?
17 config.action_controller.perform_caching = true 23 config.action_controller.perform_caching = true
24 config.action_controller.enable_fragment_cache_logging = true
18 25
19 config.cache_store = :memory_store 26 config.cache_store = :memory_store
20 config.public_file_server.headers = { 27 config.public_file_server.headers = {
21 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" 28 "Cache-Control" => "public, max-age=#{2.days.to_i}"
22 } 29 }
23 else 30 else
24 config.action_controller.perform_caching = false 31 config.action_controller.perform_caching = false
@@ -26,7 +33,11 @@ Rails.application.configure do
26 config.cache_store = :null_store 33 config.cache_store = :null_store
27 end 34 end
28 35
36 # Store uploaded files on the local file system (see config/storage.yml for options).
37 config.active_storage.service = :local
38
29 # Don't care if the mailer can't send. 39 # Don't care if the mailer can't send.
40 config.action_mailer.default_url_options = { host: 'localhost:3000' }
30 config.action_mailer.raise_delivery_errors = false 41 config.action_mailer.raise_delivery_errors = false
31 42
32 config.action_mailer.perform_caching = false 43 config.action_mailer.perform_caching = false
@@ -34,23 +45,27 @@ Rails.application.configure do
34 # Print deprecation notices to the Rails logger. 45 # Print deprecation notices to the Rails logger.
35 config.active_support.deprecation = :log 46 config.active_support.deprecation = :log
36 47
48 # Raise exceptions for disallowed deprecations.
49 config.active_support.disallowed_deprecation = :raise
50
51 # Tell Active Support which deprecation messages to disallow.
52 config.active_support.disallowed_deprecation_warnings = []
53
37 # Raise an error on page load if there are pending migrations. 54 # Raise an error on page load if there are pending migrations.
38 config.active_record.migration_error = :page_load 55 config.active_record.migration_error = :page_load
39 56
40 # Debug mode disables concatenation and preprocessing of assets. 57 # Highlight code that triggered database queries in logs.
41 # This option may cause significant delays in view rendering with a large 58 config.active_record.verbose_query_logs = true
42 # number of complex assets.
43 config.assets.debug = true
44 59
45 # Suppress logger output for asset requests. 60 # Suppress logger output for asset requests.
46 config.assets.quiet = true 61 config.assets.quiet = true
47 62
48 # Raises error for missing translations 63 # Raises error for missing translations.
49 # config.action_view.raise_on_missing_translations = true 64 # config.i18n.raise_on_missing_translations = true
50 65
51 # Use an evented file watcher to asynchronously detect changes in source code, 66 # Annotate rendered view with file names.
52 # routes, locales, etc. This feature depends on the listen gem. 67 # config.action_view.annotate_rendered_view_with_filenames = true
53 config.file_watcher = ActiveSupport::EventedFileUpdateChecker
54 68
55 config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } 69 # Uncomment if you wish to allow Action Cable access from any origin.
70 # config.action_cable.disable_request_forgery_protection = true
56end 71end
diff --git a/config/environments/production.rb b/config/environments/production.rb index 03d15d1..901cf23 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb
@@ -14,17 +14,12 @@ Rails.application.configure do
14 config.consider_all_requests_local = false 14 config.consider_all_requests_local = false
15 config.action_controller.perform_caching = true 15 config.action_controller.perform_caching = true
16 16
17 # Attempt to read encrypted secrets from `config/secrets.yml.enc`.
18 # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
19 # `config/secrets.yml.key`.
20 config.read_encrypted_secrets = true
21
22 # Disable serving static files from the `/public` folder by default since 17 # Disable serving static files from the `/public` folder by default since
23 # Apache or NGINX already handles this. 18 # Apache or NGINX already handles this.
24 config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 19 config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
25 20
26 # Compress JavaScripts and CSS. 21 # Compress JavaScripts and CSS.
27 config.assets.js_compressor = :uglifier 22 config.assets.js_compressor = :terser
28 # config.assets.css_compressor = :sass 23 # config.assets.css_compressor = :sass
29 24
30 # Do not fallback to assets pipeline if a precompiled asset is missed. 25 # Do not fallback to assets pipeline if a precompiled asset is missed.
@@ -66,7 +61,9 @@ Rails.application.configure do
66 # Set this to true and configure the email server for immediate delivery to raise delivery errors. 61 # Set this to true and configure the email server for immediate delivery to raise delivery errors.
67 # config.action_mailer.raise_delivery_errors = false 62 # config.action_mailer.raise_delivery_errors = false
68 63
69 config.action_mailer.default_url_options = { host: 'feffernoo.se' } 64 config.action_mailer.default_url_options = { host: 'www.fourisland.com' }
65 config.action_mailer.delivery_method = :smtp
66 config.action_mailer.smtp_settings = Rails.application.config_for(:mail)[:smtp_settings]
70 67
71 # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 68 # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
72 # the I18n.default_locale when a translation cannot be found). 69 # the I18n.default_locale when a translation cannot be found).
@@ -90,4 +87,7 @@ Rails.application.configure do
90 87
91 # Do not dump schema after migrations. 88 # Do not dump schema after migrations.
92 config.active_record.dump_schema_after_migration = false 89 config.active_record.dump_schema_after_migration = false
90
91 # Store uploaded files on the local file system (see config/storage.yml for options).
92 config.active_storage.service = :local
93end 93end
diff --git a/config/environments/test.rb b/config/environments/test.rb index 8e5cbde..6ea4d1e 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb
@@ -1,32 +1,41 @@
1require "active_support/core_ext/integer/time"
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
1Rails.application.configure do 8Rails.application.configure do
2 # Settings specified here will take precedence over those in config/application.rb. 9 # Settings specified here will take precedence over those in config/application.rb.
3 10
4 # The test environment is used exclusively to run your application's 11 # Turn false under Spring and add config.action_view.cache_template_loading = true.
5 # test suite. You never need to work with it otherwise. Remember that
6 # your test database is "scratch space" for the test suite and is wiped
7 # and recreated between test runs. Don't rely on the data there!
8 config.cache_classes = true 12 config.cache_classes = true
9 13
10 # Do not eager load code on boot. This avoids loading your whole application 14 # Eager loading loads your whole application. When running a single test locally,
11 # just for the purpose of running a single test. If you are using a tool that 15 # this probably isn't necessary. It's a good idea to do in a continuous integration
12 # preloads Rails for running tests, you may have to set it to true. 16 # system, or in some way before deploying your code.
13 config.eager_load = false 17 config.eager_load = ENV["CI"].present?
14 18
15 # Configure public file server for tests with Cache-Control for performance. 19 # Configure public file server for tests with Cache-Control for performance.
16 config.public_file_server.enabled = true 20 config.public_file_server.enabled = true
17 config.public_file_server.headers = { 21 config.public_file_server.headers = {
18 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}" 22 "Cache-Control" => "public, max-age=#{1.hour.to_i}"
19 } 23 }
20 24
21 # Show full error reports and disable caching. 25 # Show full error reports and disable caching.
22 config.consider_all_requests_local = true 26 config.consider_all_requests_local = true
23 config.action_controller.perform_caching = false 27 config.action_controller.perform_caching = false
28 config.cache_store = :null_store
24 29
25 # Raise exceptions instead of rendering exception templates. 30 # Raise exceptions instead of rendering exception templates.
26 config.action_dispatch.show_exceptions = false 31 config.action_dispatch.show_exceptions = false
27 32
28 # Disable request forgery protection in test environment. 33 # Disable request forgery protection in test environment.
29 config.action_controller.allow_forgery_protection = false 34 config.action_controller.allow_forgery_protection = false
35
36 # Store uploaded files on the local file system in a temporary directory.
37 config.active_storage.service = :test
38
30 config.action_mailer.perform_caching = false 39 config.action_mailer.perform_caching = false
31 40
32 # Tell Action Mailer not to deliver emails to the real world. 41 # Tell Action Mailer not to deliver emails to the real world.
@@ -37,6 +46,15 @@ Rails.application.configure do
37 # Print deprecation notices to the stderr. 46 # Print deprecation notices to the stderr.
38 config.active_support.deprecation = :stderr 47 config.active_support.deprecation = :stderr
39 48
40 # Raises error for missing translations 49 # Raise exceptions for disallowed deprecations.
41 # config.action_view.raise_on_missing_translations = true 50 config.active_support.disallowed_deprecation = :raise
51
52 # Tell Active Support which deprecation messages to disallow.
53 config.active_support.disallowed_deprecation_warnings = []
54
55 # Raises error for missing translations.
56 # config.i18n.raise_on_missing_translations = true
57
58 # Annotate rendered view with file names.
59 # config.action_view.annotate_rendered_view_with_filenames = true
42end 60end
diff --git a/config/initializers/akismet.rb b/config/initializers/akismet.rb new file mode 100644 index 0000000..a0e40dc --- /dev/null +++ b/config/initializers/akismet.rb
@@ -0,0 +1,2 @@
1Akismet.api_key = Rails.application.credentials.akismet_api_key
2Akismet.app_url = Rails.application.credentials.akismet_app_url
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index adbe234..ac7deec 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb
@@ -12,5 +12,4 @@ Rails.application.config.assets.paths << Rails.root.join('node_modules')
12# application.js, application.css, and all non-JS/CSS in the app/assets 12# application.js, application.css, and all non-JS/CSS in the app/assets
13# folder are already added. 13# folder are already added.
14# Rails.application.config.assets.precompile += %w( admin.js admin.css ) 14# Rails.application.config.assets.precompile += %w( admin.js admin.css )
15Rails.application.config.assets.precompile += %w( ckeditor/* ) 15Rails.application.config.assets.precompile += %w( main userdata admin quotes )
16Rails.application.config.assets.precompile += %w( main userdata admin )
diff --git a/config/initializers/ckeditor.rb b/config/initializers/ckeditor.rb deleted file mode 100644 index b03e4f4..0000000 --- a/config/initializers/ckeditor.rb +++ /dev/null
@@ -1,58 +0,0 @@
1# Use this hook to configure ckeditor
2Ckeditor.setup do |config|
3 # ==> ORM configuration
4 # Load and configure the ORM. Supports :active_record (default), :mongo_mapper and
5 # :mongoid (bson_ext recommended) by default. Other ORMs may be
6 # available as additional gems.
7 require 'ckeditor/orm/active_record'
8
9 # Allowed image file types for upload.
10 # Set to nil or [] (empty array) for all file types
11 # By default: %w(jpg jpeg png gif tiff)
12 # config.image_file_types = %w(jpg jpeg png gif tiff)
13
14 # Allowed flash file types for upload.
15 # Set to nil or [] (empty array) for all file types
16 # By default: %w(jpg jpeg png gif tiff)
17 # config.flash_file_types = %w(swf)
18
19 # Allowed attachment file types for upload.
20 # Set to nil or [] (empty array) for all file types
21 # By default: %w(doc docx xls odt ods pdf rar zip tar tar.gz swf)
22 # config.attachment_file_types = %w(doc docx xls odt ods pdf rar zip tar tar.gz swf)
23
24 # Setup authorization to be run as a before filter
25 # By default: there is no authorization.
26 # config.authorize_with :cancan
27
28 # Override parent controller CKEditor inherits from
29 # By default: 'ApplicationController'
30 # config.parent_controller = 'MyController'
31
32 # Asset model classes
33 # config.picture_model { Ckeditor::Picture }
34 # config.attachment_file_model { Ckeditor::AttachmentFile }
35
36 # Paginate assets
37 # By default: 24
38 # config.default_per_page = 24
39
40 # Customize ckeditor assets path
41 # By default: nil
42 # config.asset_path = 'http://www.example.com/assets/ckeditor/'
43
44 # To reduce the asset precompilation time, you can limit plugins and/or languages to those you need:
45 # By default: nil (no limit)
46 config.assets_languages = ['en']
47 # config.assets_plugins = ['image', 'smiley']
48
49 # CKEditor CDN
50 # More info here http://cdn.ckeditor.com/
51 # By default: nil (CDN disabled)
52 # config.cdn_url = '//cdn.ckeditor.com/4.7.1/standard/ckeditor.js'
53
54 # JS config url
55 # Used when CKEditor CDN enabled
56 # By default: "ckeditor/config.js"
57 # config.js_config_url = 'ckeditor/config.js'
58end
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb new file mode 100644 index 0000000..54f47cf --- /dev/null +++ b/config/initializers/content_security_policy.rb
@@ -0,0 +1,25 @@
1# Be sure to restart your server when you modify this file.
2
3# Define an application-wide content security policy.
4# See the Securing Rails Applications Guide for more information:
5# https://guides.rubyonrails.org/security.html#content-security-policy-header
6
7# Rails.application.configure do
8# 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# # Specify URI for violation reports
16# # policy.report_uri "/csp-violation-report-endpoint"
17# end
18#
19# # Generate session nonces for permitted importmap and inline scripts
20# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21# config.content_security_policy_nonce_directives = %w(script-src)
22#
23# # Report violations without enforcing the policy.
24# # config.content_security_policy_report_only = true
25# end
diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4a994e1..adc6568 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb
@@ -1,4 +1,8 @@
1# Be sure to restart your server when you modify this file. 1# Be sure to restart your server when you modify this file.
2 2
3# Configure sensitive parameters which will be filtered from the log file. 3# Configure parameters to be filtered from the log file. Use this to limit dissemination of
4Rails.application.config.filter_parameters += [:password] 4# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
5# notations and behaviors.
6Rails.application.config.filter_parameters += [
7 :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
8]
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index ac033bf..3860f65 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb
@@ -4,13 +4,13 @@
4# are locale specific, and you may define rules for as many different 4# are locale specific, and you may define rules for as many different
5# locales as you wish. All of these examples are active by default: 5# locales as you wish. All of these examples are active by default:
6# ActiveSupport::Inflector.inflections(:en) do |inflect| 6# ActiveSupport::Inflector.inflections(:en) do |inflect|
7# inflect.plural /^(ox)$/i, '\1en' 7# inflect.plural /^(ox)$/i, "\\1en"
8# inflect.singular /^(ox)en/i, '\1' 8# inflect.singular /^(ox)en/i, "\\1"
9# inflect.irregular 'person', 'people' 9# inflect.irregular "person", "people"
10# inflect.uncountable %w( fish sheep ) 10# inflect.uncountable %w( fish sheep )
11# end 11# end
12 12
13# These inflection rules are supported but not enabled by default: 13# These inflection rules are supported but not enabled by default:
14# ActiveSupport::Inflector.inflections(:en) do |inflect| 14# ActiveSupport::Inflector.inflections(:en) do |inflect|
15# inflect.acronym 'RESTful' 15# inflect.acronym "RESTful"
16# end 16# end
diff --git a/config/initializers/js_routes.rb b/config/initializers/js_routes.rb new file mode 100644 index 0000000..7bc0c65 --- /dev/null +++ b/config/initializers/js_routes.rb
@@ -0,0 +1,7 @@
1JsRoutes.setup do |c|
2 # Setup your JS module system:
3 # ESM, CJS, AMD, UMD or nil
4 # c.module_type = "ESM"
5 c.module_type = nil
6 c.namespace = 'Routes'
7end
diff --git a/config/initializers/new_framework_defaults_7_0.rb b/config/initializers/new_framework_defaults_7_0.rb new file mode 100644 index 0000000..4d58024 --- /dev/null +++ b/config/initializers/new_framework_defaults_7_0.rb
@@ -0,0 +1,135 @@
1# Be sure to restart your server when you modify this file.
2#
3# This file eases your Rails 7.0 framework defaults upgrade.
4#
5# Uncomment each configuration one by one to switch to the new default.
6# Once your application is ready to run with all new defaults, you can remove
7# this file and set the `config.load_defaults` to `7.0`.
8#
9# Read the Guide for Upgrading Ruby on Rails for more info on each option.
10# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
11
12# `button_to` view helper will render `<button>` element, regardless of whether
13# or not the content is passed as the first argument or as a block.
14# Rails.application.config.action_view.button_to_generates_button_tag = true
15
16# `stylesheet_link_tag` view helper will not render the media attribute by default.
17# Rails.application.config.action_view.apply_stylesheet_media_default = false
18
19# Change the digest class for the key generators to `OpenSSL::Digest::SHA256`.
20# Changing this default means invalidate all encrypted messages generated by
21# your application and, all the encrypted cookies. Only change this after you
22# rotated all the messages using the key rotator.
23#
24# See upgrading guide for more information on how to build a rotator.
25# https://guides.rubyonrails.org/v7.0/upgrading_ruby_on_rails.html
26# Rails.application.config.active_support.key_generator_hash_digest_class = OpenSSL::Digest::SHA256
27
28# Change the digest class for ActiveSupport::Digest.
29# Changing this default means that for example Etags change and
30# various cache keys leading to cache invalidation.
31# Rails.application.config.active_support.hash_digest_class = OpenSSL::Digest::SHA256
32
33# Don't override ActiveSupport::TimeWithZone.name and use the default Ruby
34# implementation.
35# Rails.application.config.active_support.remove_deprecated_time_with_zone_name = true
36
37# Calls `Rails.application.executor.wrap` around test cases.
38# This makes test cases behave closer to an actual request or job.
39# Several features that are normally disabled in test, such as Active Record query cache
40# and asynchronous queries will then be enabled.
41# Rails.application.config.active_support.executor_around_test_case = true
42
43# Define the isolation level of most of Rails internal state.
44# If you use a fiber based server or job processor, you should set it to `:fiber`.
45# Otherwise the default of `:thread` if preferable.
46# Rails.application.config.active_support.isolation_level = :thread
47
48# Set both the `:open_timeout` and `:read_timeout` values for `:smtp` delivery method.
49# Rails.application.config.action_mailer.smtp_timeout = 5
50
51# The ActiveStorage video previewer will now use scene change detection to generate
52# better preview images (rather than the previous default of using the first frame
53# of the video).
54# Rails.application.config.active_storage.video_preview_arguments =
55# "-vf 'select=eq(n\\,0)+eq(key\\,1)+gt(scene\\,0.015),loop=loop=-1:size=2,trim=start_frame=1' -frames:v 1 -f image2"
56
57# Automatically infer `inverse_of` for associations with a scope.
58# Rails.application.config.active_record.automatic_scope_inversing = true
59
60# Raise when running tests if fixtures contained foreign key violations
61# Rails.application.config.active_record.verify_foreign_keys_for_fixtures = true
62
63# Disable partial inserts.
64# This default means that all columns will be referenced in INSERT queries
65# regardless of whether they have a default or not.
66# Rails.application.config.active_record.partial_inserts = false
67
68# Protect from open redirect attacks in `redirect_back_or_to` and `redirect_to`.
69# Rails.application.config.action_controller.raise_on_open_redirects = true
70
71# Change the variant processor for Active Storage.
72# Changing this default means updating all places in your code that
73# generate variants to use image processing macros and ruby-vips
74# operations. See the upgrading guide for detail on the changes required.
75# The `:mini_magick` option is not deprecated; it's fine to keep using it.
76# Rails.application.config.active_storage.variant_processor = :vips
77
78# Enable parameter wrapping for JSON.
79# Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
80# To disable parameter wrapping entirely, set this config to `false`.
81# Rails.application.config.action_controller.wrap_parameters_by_default = true
82
83# Specifies whether generated namespaced UUIDs follow the RFC 4122 standard for namespace IDs provided as a
84# `String` to `Digest::UUID.uuid_v3` or `Digest::UUID.uuid_v5` method calls.
85#
86# See https://guides.rubyonrails.org/configuring.html#config-active-support-use-rfc4122-namespaced-uuids for
87# more information.
88# Rails.application.config.active_support.use_rfc4122_namespaced_uuids = true
89
90# Change the default headers to disable browsers' flawed legacy XSS protection.
91# Rails.application.config.action_dispatch.default_headers = {
92# "X-Frame-Options" => "SAMEORIGIN",
93# "X-XSS-Protection" => "0",
94# "X-Content-Type-Options" => "nosniff",
95# "X-Download-Options" => "noopen",
96# "X-Permitted-Cross-Domain-Policies" => "none",
97# "Referrer-Policy" => "strict-origin-when-cross-origin"
98# }
99
100
101# ** Please read carefully, this must be configured in config/application.rb **
102# Change the format of the cache entry.
103# Changing this default means that all new cache entries added to the cache
104# will have a different format that is not supported by Rails 6.1 applications.
105# Only change this value after your application is fully deployed to Rails 7.0
106# and you have no plans to rollback.
107# When you're ready to change format, add this to `config/application.rb` (NOT this file):
108# config.active_support.cache_format_version = 7.0
109
110
111# Cookie serializer: 2 options
112#
113# If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
114# is `:marshal`. The default for new apps is `:json`.
115#
116# Rails.application.config.action_dispatch.cookies_serializer = :json
117#
118#
119# To migrate an existing application to the `:json` serializer, use the `:hybrid` option.
120#
121# Rails transparently deserializes existing (Marshal-serialized) cookies on read and
122# re-writes them in the JSON format.
123#
124# It is fine to use `:hybrid` long term; you should do that until you're confident *all* your cookies
125# have been converted to JSON. To keep using `:hybrid` long term, move this config to its own
126# initializer or to `config/application.rb`.
127#
128# Rails.application.config.action_dispatch.cookies_serializer = :hybrid
129#
130#
131# If your cookies can't yet be serialized to JSON, keep using `:marshal` for backward-compatibility.
132#
133# If you have configured the serializer elsewhere, you can remove this section of the file.
134#
135# See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.
diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb new file mode 100644 index 0000000..00f64d7 --- /dev/null +++ b/config/initializers/permissions_policy.rb
@@ -0,0 +1,11 @@
1# Define an application-wide HTTP permissions policy. For further
2# information see https://developers.google.com/web/updates/2018/06/feature-policy
3#
4# Rails.application.config.permissions_policy do |f|
5# f.camera :none
6# f.gyroscope :none
7# f.microphone :none
8# f.usb :none
9# f.fullscreen :self
10# f.payment :self, "https://secure.example.com"
11# end
diff --git a/config/initializers/recaptcha.rb b/config/initializers/recaptcha.rb new file mode 100644 index 0000000..807a23c --- /dev/null +++ b/config/initializers/recaptcha.rb
@@ -0,0 +1,4 @@
1Recaptcha.configure do |config|
2 config.site_key = Rails.application.credentials.recaptcha_site_key
3 config.secret_key = Rails.application.credentials.recaptcha_secret_key
4end
diff --git a/config/initializers/yaml_serialization.rb b/config/initializers/yaml_serialization.rb new file mode 100644 index 0000000..7c3ca58 --- /dev/null +++ b/config/initializers/yaml_serialization.rb
@@ -0,0 +1 @@
Rails.application.config.active_record.yaml_column_permitted_classes = [Enumerize::Value]
diff --git a/config/mail.yml b/config/mail.yml new file mode 100644 index 0000000..6c0435d --- /dev/null +++ b/config/mail.yml
@@ -0,0 +1,8 @@
1production:
2 smtp_settings:
3 address: "mail.smtp2go.com"
4 port: 2525
5 user_name: "fourisland.com"
6 password: <%= Rails.application.credentials.smtp2go_password %>
7 authentication: "plain"
8 openssl_verify_mode: "none"
diff --git a/config/routes.rb b/config/routes.rb index ac5b84d..ad66501 100644 --- a/config/routes.rb +++ b/config/routes.rb
@@ -11,20 +11,79 @@ Rails.application.routes.draw do
11 resources :streams, except: [:show] do 11 resources :streams, except: [:show] do
12 resources :updates, except: [:index, :show] 12 resources :updates, except: [:index, :show]
13 end 13 end
14 end
15 14
16 mount Ckeditor::Engine => '/ckeditor' 15 resources :links, except: [:show]
16
17 resources :games, except: [:show]
18
19 resources :comments, only: [:index, :destroy] do
20 collection do
21 get 'pending'
22 post 'mass'
23 end
24
25 member do
26 post 'accept'
27 post 'reject'
28 post 'mark_spam'
29 end
30 end
31
32 resources :quotes do
33 collection do
34 get 'pending'
35 end
36
37 member do
38 post 'accept'
39 end
40 end
41 end
17 42
18 devise_for :users, controllers: { 43 devise_for :users, controllers: {
19 sessions: 'users/sessions', 44 sessions: 'users/sessions',
20 passwords: 'users/passwords' 45 passwords: 'users/passwords'
21 } 46 }
22 47
23 root "records#index" 48 root "blogs#summary"
49
50 resources :blogs, only: [:index, :show], param: :slug, path: "blog" do
51 member do
52 post 'upvote'
53 post 'downvote'
24 54
25 get 'says/:slug', to: 'blogs#show', as: :blog 55 resources :comments, only: [:create]
56 end
57 end
26 58
59 get 'thinks', to: 'streams#index', as: :streams
27 get 'thinks/:slug', to: 'streams#show', as: :stream 60 get 'thinks/:slug', to: 'streams#show', as: :stream
28 61
29 mount Pokeviewer::Engine => '/poke3' 62 get 'plays', to: 'games#index'
63
64 resources :tags, only: [:index, :show], param: :name do
65 collection do
66 get 'suggest'
67 end
68 end
69
70 resources :quotes do
71 collection do
72 get 'latest'
73 get 'top'
74 get 'random'
75 get 'tags'
76 get 'tags/:id', :action => "tag", :as => "tag"
77 get 'stats'
78 get 'search_form'
79 get 'search'
80 end
81
82 member do
83 post 'upvote'
84 post 'downvote'
85 end
86 end
87
88 resources :webmentions, only: [:create]
30end 89end
diff --git a/config/schedule.rb b/config/schedule.rb new file mode 100644 index 0000000..268dfcb --- /dev/null +++ b/config/schedule.rb
@@ -0,0 +1,27 @@
1# Use this file to easily define all of your cron jobs.
2#
3# It's helpful, but not entirely necessary to understand cron before proceeding.
4# http://en.wikipedia.org/wiki/Cron
5
6# Example:
7#
8# set :output, "/path/to/my/cron_log.log"
9#
10# every 2.hours do
11# command "/usr/bin/some_great_command"
12# runner "MyModel.some_method"
13# rake "some:great:rake:task"
14# end
15#
16# every 4.days do
17# runner "AnotherModel.prune_old_records"
18# end
19
20# Learn more: http://github.com/javan/whenever
21every 1.day, at: "6:00am" do
22 rake "thoughts:email_upvote_report"
23end
24
25every 6.hours do
26 rake "thoughts:refresh_scrobbles"
27end
diff --git a/config/secrets.yml b/config/secrets.yml deleted file mode 100644 index 31946ec..0000000 --- a/config/secrets.yml +++ /dev/null
@@ -1,32 +0,0 @@
1# Be sure to restart your server when you modify this file.
2
3# Your secret key is used for verifying the integrity of signed cookies.
4# If you change this key, all old signed cookies will become invalid!
5
6# Make sure the secret is at least 30 characters and all random,
7# no regular words or you'll be exposed to dictionary attacks.
8# You can use `rails secret` to generate a secure secret key.
9
10# Make sure the secrets in this file are kept private
11# if you're sharing your code publicly.
12
13# Shared secrets are available across all environments.
14
15# shared:
16# api_key: a1B2c3D4e5F6
17
18# Environmental secrets are only available for that specific environment.
19
20development:
21 secret_key_base: d56c163402b7f74e65934e2a5d5a0990a8120dc88c39c5ca00c143cbc1551f0d21e811cbd246c282ffc58d46286f5ae7d3231696c21772b252f137c24de0aa3f
22
23test:
24 secret_key_base: 66e64fc722045f0e636e7658997477d4e265d14e5dfef59f045e3512019b38a885320274116edf354d390a6019555848a89d8a3e01a6091df83032120edff6ac
25
26# Do not keep production secrets in the unencrypted secrets file.
27# Instead, either read values from the environment.
28# Or, use `bin/rails secrets:setup` to configure encrypted secrets
29# and move the `production:` environment over there.
30
31production:
32 secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
diff --git a/config/storage.yml b/config/storage.yml new file mode 100644 index 0000000..4942ab6 --- /dev/null +++ b/config/storage.yml
@@ -0,0 +1,34 @@
1test:
2 service: Disk
3 root: <%= Rails.root.join("tmp/storage") %>
4
5local:
6 service: Disk
7 root: <%= Rails.root.join("storage") %>
8
9# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10# amazon:
11# service: S3
12# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14# region: us-east-1
15# bucket: your_own_bucket-<%= Rails.env %>
16
17# Remember not to checkin your GCS keyfile to a repository
18# google:
19# service: GCS
20# project: your_project
21# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22# bucket: your_own_bucket-<%= Rails.env %>
23
24# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25# microsoft:
26# service: AzureStorage
27# storage_account_name: your_account_name
28# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29# container: your_container_name-<%= Rails.env %>
30
31# mirror:
32# service: Mirror
33# primary: local
34# mirrors: [ amazon, google, microsoft ]