-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
283 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,34 @@ | ||
require File.expand_path("../boot", __FILE__) | ||
require_relative "boot" | ||
|
||
require "rails" | ||
# Pick the frameworks you want: | ||
require "active_model/railtie" | ||
require "active_job/railtie" | ||
require "active_record/railtie" | ||
# require "active_storage/engine" | ||
require "action_controller/railtie" | ||
require "action_mailer/railtie" | ||
# require "action_mailbox/engine" | ||
# require "action_text/engine" | ||
require "action_view/railtie" | ||
# require "action_cable/engine" | ||
# require "sprockets/railtie" | ||
# require "rails/test_unit/railtie" | ||
require "rails/test_unit/railtie" | ||
|
||
# Require the gems listed in Gemfile, including any gems | ||
# you've limited to :test, :development, or :production. | ||
Bundler.require(*Rails.groups) | ||
|
||
module Flaredown | ||
class Application < Rails::Application | ||
# https://medium.com/@Nicholson85/handling-cors-issues-in-your-rails-api-120dfbcb8a24 | ||
# fix CORS issues in staging? | ||
config.middleware.insert_before 0, Rack::Cors do | ||
allow do | ||
origins "*" | ||
resource "*", headers: :any, methods: [:get, :post, :put, :patch, :delete, :options, :head] | ||
end | ||
end | ||
# Settings in config/environments/* take precedence over those specified here. | ||
# Application configuration should go into files in config/initializers | ||
# -- all .rb files in that directory are automatically loaded. | ||
config.autoload_paths << Rails.root.join("lib") | ||
config.autoload_paths << Rails.root.join("lib/*") | ||
config.autoload_paths << Rails.root.join("lib/**/*") | ||
config.autoload_paths << Rails.root.join("app/serializers/concerns") | ||
config.autoload_paths << Rails.root.join("app/serializers/api/v1/concerns") | ||
# Initialize configuration defaults for originally generated Rails version. | ||
config.load_defaults 5.0 | ||
|
||
# Only loads a smaller set of middleware suitable for API only apps. | ||
# Middleware like session, flash, cookies can be added back manually. | ||
# Skip views, helpers and assets when generating a new resource. | ||
config.api_only = false | ||
|
||
config.generators.orm :active_record | ||
|
||
config.active_record.schema_format = :sql | ||
|
||
# Be sure to have the adapter's gem in your Gemfile | ||
# and follow the adapter's specific installation | ||
# and deployment instructions. | ||
config.active_job.queue_adapter = :sidekiq | ||
# Configuration for the application, engines, and railties goes here. | ||
# | ||
# These settings can be overridden in specific environments using the files | ||
# in config/environments, which are processed later. | ||
# | ||
# config.time_zone = "Central Time (US & Canada)" | ||
# config.eager_load_paths << Rails.root.join("extras") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__) | ||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) | ||
|
||
require "bundler/setup" # Set up gems listed in the Gemfile. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Load the Rails application. | ||
require File.expand_path("../application", __FILE__) | ||
require_relative "application" | ||
|
||
# Initialize the Rails application. | ||
Rails.application.initialize! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,65 @@ | ||
require "active_support/core_ext/integer/time" | ||
|
||
Rails.application.configure do | ||
# Settings specified here will take precedence over those in config/application.rb. | ||
|
||
# In the development environment your application's code is reloaded on | ||
# every request. This slows down response time but is perfect for development | ||
# In the development environment your application's code is reloaded any time | ||
# it changes. This slows down response time but is perfect for development | ||
# since you don't have to restart the web server when you make code changes. | ||
config.cache_classes = false | ||
|
||
# Do not eager load code on boot. | ||
config.eager_load = false | ||
|
||
# Show full error reports and disable caching. | ||
# Show full error reports. | ||
config.consider_all_requests_local = true | ||
config.action_controller.perform_caching = false | ||
|
||
# Enable server timing | ||
config.server_timing = true | ||
|
||
# Enable/disable caching. By default caching is disabled. | ||
# Run rails dev:cache to toggle caching. | ||
if Rails.root.join("tmp/caching-dev.txt").exist? | ||
config.action_controller.perform_caching = true | ||
config.action_controller.enable_fragment_cache_logging = true | ||
|
||
config.cache_store = :memory_store | ||
config.public_file_server.headers = { | ||
"Cache-Control" => "public, max-age=#{2.days.to_i}" | ||
} | ||
else | ||
config.action_controller.perform_caching = false | ||
|
||
config.cache_store = :null_store | ||
end | ||
|
||
# Don't care if the mailer can't send. | ||
config.action_mailer.raise_delivery_errors = false | ||
|
||
config.action_mailer.perform_caching = false | ||
|
||
# Print deprecation notices to the Rails logger. | ||
config.active_support.deprecation = :log | ||
|
||
# Raise exceptions for disallowed deprecations. | ||
config.active_support.disallowed_deprecation = :raise | ||
|
||
# Tell Active Support which deprecation messages to disallow. | ||
config.active_support.disallowed_deprecation_warnings = [] | ||
|
||
# Raise an error on page load if there are pending migrations. | ||
config.active_record.migration_error = :page_load | ||
|
||
# Raises error for missing translations | ||
# config.action_view.raise_on_missing_translations = true | ||
# Highlight code that triggered database queries in logs. | ||
config.active_record.verbose_query_logs = true | ||
|
||
|
||
# Raises error for missing translations. | ||
# config.i18n.raise_on_missing_translations = true | ||
|
||
# Annotate rendered view with file names. | ||
# config.action_view.annotate_rendered_view_with_filenames = true | ||
|
||
# Delivery with letter opener | ||
config.action_mailer.delivery_method = :letter_opener | ||
# Uncomment if you wish to allow Action Cable access from any origin. | ||
# config.action_cable.disable_request_forgery_protection = true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,57 @@ | ||
require "active_support/core_ext/integer/time" | ||
|
||
# The test environment is used exclusively to run your application's | ||
# test suite. You never need to work with it otherwise. Remember that | ||
# your test database is "scratch space" for the test suite and is wiped | ||
# and recreated between test runs. Don't rely on the data there! | ||
|
||
Rails.application.configure do | ||
# Settings specified here will take precedence over those in config/application.rb. | ||
|
||
# The test environment is used exclusively to run your application's | ||
# test suite. You never need to work with it otherwise. Remember that | ||
# your test database is "scratch space" for the test suite and is wiped | ||
# and recreated between test runs. Don't rely on the data there! | ||
# Turn false under Spring and add config.action_view.cache_template_loading = true. | ||
config.cache_classes = true | ||
|
||
# Do not eager load code on boot. This avoids loading your whole application | ||
# just for the purpose of running a single test. If you are using a tool that | ||
# preloads Rails for running tests, you may have to set it to true. | ||
config.eager_load = false | ||
# Eager loading loads your whole application. When running a single test locally, | ||
# this probably isn't necessary. It's a good idea to do in a continuous integration | ||
# system, or in some way before deploying your code. | ||
config.eager_load = ENV["CI"].present? | ||
|
||
# Configure static file server for tests with Cache-Control for performance. | ||
# Configure public file server for tests with Cache-Control for performance. | ||
config.public_file_server.enabled = true | ||
config.public_file_server.headers = {"Cache-Control" => "public, max-age=3600"} | ||
config.public_file_server.headers = { | ||
"Cache-Control" => "public, max-age=#{1.hour.to_i}" | ||
} | ||
|
||
# Show full error reports and disable caching. | ||
config.consider_all_requests_local = true | ||
config.consider_all_requests_local = true | ||
config.action_controller.perform_caching = false | ||
config.cache_store = :null_store | ||
|
||
# Raise exceptions instead of rendering exception templates. | ||
config.action_dispatch.show_exceptions = false | ||
|
||
# Disable request forgery protection in test environment. | ||
config.action_controller.allow_forgery_protection = false | ||
|
||
config.action_mailer.perform_caching = false | ||
|
||
# Tell Action Mailer not to deliver emails to the real world. | ||
# The :test delivery method accumulates sent emails in the | ||
# ActionMailer::Base.deliveries array. | ||
config.action_mailer.delivery_method = :test | ||
|
||
# Randomize the order test cases are executed. | ||
config.active_support.test_order = :random | ||
|
||
# Print deprecation notices to the stderr. | ||
config.active_support.deprecation = :stderr | ||
|
||
# Raises error for missing translations | ||
# config.action_view.raise_on_missing_translations = true | ||
# Raise exceptions for disallowed deprecations. | ||
config.active_support.disallowed_deprecation = :raise | ||
|
||
# Tell Active Support which deprecation messages to disallow. | ||
config.active_support.disallowed_deprecation_warnings = [] | ||
|
||
# Raises error for missing translations. | ||
# config.i18n.raise_on_missing_translations = true | ||
|
||
# Annotate rendered view with file names. | ||
# config.action_view.annotate_rendered_view_with_filenames = true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Be sure to restart your server when you modify this file. | ||
|
||
# Define an application-wide content security policy | ||
# For further information see the following documentation | ||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy | ||
|
||
# Rails.application.configure do | ||
# config.content_security_policy do |policy| | ||
# policy.default_src :self, :https | ||
# policy.font_src :self, :https, :data | ||
# policy.img_src :self, :https, :data | ||
# policy.object_src :none | ||
# policy.script_src :self, :https | ||
# policy.style_src :self, :https | ||
# # Specify URI for violation reports | ||
# # policy.report_uri "/csp-violation-report-endpoint" | ||
# end | ||
# | ||
# # Generate session nonces for permitted importmap and inline scripts | ||
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } | ||
# config.content_security_policy_nonce_directives = %w(script-src) | ||
# | ||
# # Report CSP violations to a specified URI. See: | ||
# # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only | ||
# # config.content_security_policy_report_only = true | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# Be sure to restart your server when you modify this file. | ||
|
||
# Configure sensitive parameters which will be filtered from the log file. | ||
Rails.application.config.filter_parameters += [:password] | ||
Rails.application.config.filter_parameters += [ | ||
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.