Update configs for rails 5
Used `rails app:update`
This commit is contained in:
parent
b711a8d4a1
commit
3d7061b240
17 changed files with 187 additions and 96 deletions
|
|
@ -1,7 +1,10 @@
|
|||
require_relative 'boot'
|
||||
|
||||
require 'rails/all'
|
||||
Bundler.require(:default, *Bundler.settings.with, Rails.env)
|
||||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
# you've limited to :test, :development, or :production.
|
||||
Bundler.require(*Rails.groups(*Bundler.settings.with))
|
||||
|
||||
# Do not dump the limit of boolean fields on MySQL,
|
||||
# since that generates a db/schema.rb that's incompatible
|
||||
|
|
@ -24,6 +27,9 @@ require_relative 'asset_sync'
|
|||
|
||||
module Diaspora
|
||||
class Application < Rails::Application
|
||||
# Initialize configuration defaults for originally generated Rails version.
|
||||
config.load_defaults 5.1
|
||||
|
||||
# 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.
|
||||
|
|
@ -64,8 +70,9 @@ module Diaspora
|
|||
# Speed up precompile by not loading the environment
|
||||
config.assets.initialize_on_precompile = false
|
||||
|
||||
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
||||
config.assets.precompile += %w(
|
||||
# Precompile additional assets.
|
||||
# (application.js, application.css, and all non-JS/CSS in the app/assets are already added)
|
||||
config.assets.precompile += %w[
|
||||
contact-list.js
|
||||
ie.js
|
||||
jquery3.js
|
||||
|
|
@ -82,10 +89,7 @@ module Diaspora
|
|||
rtl.css
|
||||
color_themes/*/desktop.css
|
||||
color_themes/*/mobile.css
|
||||
)
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets
|
||||
config.assets.version = '1.0'
|
||||
]
|
||||
|
||||
# See lib/tasks/assets.rake: non_digest_assets
|
||||
config.assets.non_digest_assets = %w(branding/logos/asterisk.png)
|
||||
|
|
@ -96,9 +100,6 @@ module Diaspora
|
|||
g.test_framework :rspec
|
||||
end
|
||||
|
||||
# Will be default with Rails 5
|
||||
config.active_record.raise_in_transactional_callbacks = true
|
||||
|
||||
# Setup action mailer early
|
||||
config.action_mailer.default_url_options = {
|
||||
protocol: AppConfig.pod_uri.scheme,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
# Set up gems listed in the Gemfile.
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||
|
||||
# Ensure Builder is loaded
|
||||
require 'active_support/builder' unless defined?(Builder)
|
||||
require "bundler/setup" # Set up gems listed in the Gemfile.
|
||||
|
||||
# Load configuration early
|
||||
require_relative 'load_config'
|
||||
require_relative "load_config"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Load the rails application
|
||||
# Load the Rails application.
|
||||
require_relative 'application'
|
||||
|
||||
# Initialize the rails application
|
||||
Diaspora::Application.initialize!
|
||||
# Initialize the Rails application.
|
||||
Rails.application.initialize!
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Diaspora::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
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
|
||||
|
|
@ -9,30 +9,40 @@ Diaspora::Application.configure do
|
|||
# Do not eager load code on boot.
|
||||
config.eager_load = false
|
||||
|
||||
# Show full error reports and disable caching
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
# Show full error reports.
|
||||
config.consider_all_requests_local = true
|
||||
|
||||
# Don't care if the mailer can't send
|
||||
# Enable/disable caching. By default caching is disabled.
|
||||
if Rails.root.join("tmp", "caching-dev.txt").exist?
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
config.cache_store = :memory_store
|
||||
config.public_file_server.headers = {
|
||||
"Cache-Control" => "public, max-age=#{2.days.seconds.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
|
||||
|
||||
# Raise an error on page load if there are pending migrations
|
||||
config.active_record.migration_error = :page_load
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Print deprecation notices to the Rails logger
|
||||
# Print deprecation notices to the Rails logger.
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
# Only use best-standards-support built into browsers
|
||||
config.action_dispatch.best_standards_support = :builtin
|
||||
# Raise an error on page load if there are pending migrations.
|
||||
config.active_record.migration_error = :page_load
|
||||
|
||||
|
||||
# Do not compress assets
|
||||
config.assets.compress = false
|
||||
|
||||
# Expands the lines which load the assets
|
||||
# Debug mode disables concatenation and preprocessing of assets.
|
||||
# This option may cause significant delays in view rendering with a large
|
||||
# number of complex assets.
|
||||
config.assets.debug = true
|
||||
|
||||
# No assets request logging
|
||||
# Suppress logger output for asset requests.
|
||||
config.assets.quiet = true
|
||||
|
||||
# Set the logging destination(s)
|
||||
|
|
@ -41,6 +51,13 @@ Diaspora::Application.configure do
|
|||
# Show the logging configuration on STDOUT
|
||||
config.show_log_configuration = true
|
||||
|
||||
# Raises error for missing translations
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
|
||||
# Use an evented file watcher to asynchronously detect changes in source code,
|
||||
# routes, locales, etc. This feature depends on the listen gem.
|
||||
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||
|
||||
# Speed up asset serving
|
||||
config.middleware.insert 0, TurboDevAssets
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,35 +1,51 @@
|
|||
Diaspora::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# Code is not reloaded between requests
|
||||
# Code is not reloaded between requests.
|
||||
config.cache_classes = true
|
||||
|
||||
# Eager load code on boot. This eager loads most of Rails and
|
||||
# your application in memory, allowing both thread web servers
|
||||
# your application in memory, allowing both threaded web servers
|
||||
# and those relying on copy on write to perform better.
|
||||
# Rake tasks automatically ignore this option for performance.
|
||||
config.eager_load = true
|
||||
|
||||
# Full error reports are disabled and caching is turned on
|
||||
# Full error reports are disabled and caching is turned on.
|
||||
config.consider_all_requests_local = false
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Disable Rails's static asset server (Apache or nginx will already do this)
|
||||
config.serve_static_files = false
|
||||
# Attempt to read encrypted secrets from `config/secrets.yml.enc`.
|
||||
# Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
|
||||
# `config/secrets.yml.key`.
|
||||
config.read_encrypted_secrets = true
|
||||
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
# Apache or NGINX already handles this.
|
||||
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
# config.assets.css_compressor = :sass
|
||||
|
||||
# Don't fallback to assets pipeline if a precompiled asset is missed
|
||||
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||
config.assets.compile = false
|
||||
|
||||
# Generate digests for assets URLs
|
||||
# Generate digests for assets URLs.
|
||||
config.assets.digest = true
|
||||
|
||||
# Specifies the header that your server uses for sending files
|
||||
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
if AppConfig.environment.assets.host.present?
|
||||
config.action_controller.asset_host = AppConfig.environment.assets.host.get
|
||||
end
|
||||
|
||||
# Specifies the header that your server uses for sending files.
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
||||
|
||||
# Mount Action Cable outside main process or domain
|
||||
# config.action_cable.mount_path = nil
|
||||
# config.action_cable.url = 'wss://example.com/cable'
|
||||
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
# config.force_ssl = true
|
||||
|
|
@ -37,44 +53,44 @@ Diaspora::Application.configure do
|
|||
# Log level
|
||||
config.log_level = :info
|
||||
|
||||
# Prepend all log lines with the following tags.
|
||||
# config.log_tags = [ :request_id ]
|
||||
|
||||
# Set the logging destination(s)
|
||||
config.log_to = %w[file]
|
||||
|
||||
# Show the logging configuration on STDOUT
|
||||
config.show_log_configuration = false
|
||||
|
||||
# Prepend all log lines with the following tags
|
||||
# config.log_tags = [ :subdomain, :uuid ]
|
||||
|
||||
# Use a different logger for distributed setups
|
||||
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
||||
|
||||
# Use a different cache store in production
|
||||
# Use a different cache store in production.
|
||||
# config.cache_store = :mem_cache_store
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
||||
# config.action_controller.asset_host = "http://assets.example.com"
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
||||
# config.assets.precompile += %w( search.js )
|
||||
|
||||
# Disable delivery errors, bad email addresses will be ignored
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||
# config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
# Enable autoload for rake tasks
|
||||
config.dependency_loading = true if $rails_rake_task
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# the I18n.default_locale when a translation can not be found)
|
||||
# the I18n.default_locale when a translation cannot be found).
|
||||
config.i18n.fallbacks = true
|
||||
|
||||
# Send deprecation notices to registered listeners
|
||||
# Send deprecation notices to registered listeners.
|
||||
config.active_support.deprecation = :notify
|
||||
|
||||
# For nginx:
|
||||
config.action_dispatch.x_sendfile_header = "X-Accel-Redirect"
|
||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||
# config.log_formatter = ::Logger::Formatter.new
|
||||
|
||||
if AppConfig.environment.assets.host.present?
|
||||
config.action_controller.asset_host = AppConfig.environment.assets.host.get
|
||||
end
|
||||
# Use a different logger for distributed setups.
|
||||
# require 'syslog/logger'
|
||||
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
||||
|
||||
# if ENV["RAILS_LOG_TO_STDOUT"].present?
|
||||
# logger = ActiveSupport::Logger.new(STDOUT)
|
||||
# logger.formatter = config.log_formatter
|
||||
# config.logger = ActiveSupport::TaggedLogging.new(logger)
|
||||
# end
|
||||
|
||||
# Do not dump schema after migrations.
|
||||
config.active_record.dump_schema_after_migration = false
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Diaspora::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
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
|
||||
|
|
@ -12,11 +12,13 @@ Diaspora::Application.configure do
|
|||
# preloads Rails for running tests, you may have to set it to true.
|
||||
config.eager_load = false
|
||||
|
||||
# Configure static asset server for tests with Cache-Control for performance
|
||||
config.serve_static_files = true
|
||||
config.static_cache_control = "public, max-age=3600"
|
||||
# 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=#{1.hour.seconds.to_i}"
|
||||
}
|
||||
|
||||
# No assets request logging
|
||||
# Suppress logger output for asset requests.
|
||||
config.assets.quiet = true
|
||||
|
||||
# Precompile poltergeist_disable_transition.css for tests
|
||||
|
|
@ -30,24 +32,28 @@ Diaspora::Application.configure do
|
|||
color_themes/original/mobile.css
|
||||
]
|
||||
|
||||
# Show full error reports and disable caching
|
||||
# Show full error reports and disable caching.
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
# Raise exceptions instead of rendering exception templates
|
||||
config.action_dispatch.show_exceptions = true
|
||||
# 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
|
||||
# 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
|
||||
|
||||
# Print deprecation notices to the stderr
|
||||
# Print deprecation notices to the stderr.
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
# Set the logging destination(s)
|
||||
config.log_to = %w[file]
|
||||
|
||||
# Raises error for missing translations
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
end
|
||||
|
|
|
|||
6
config/initializers/application_controller_renderer.rb
Normal file
6
config/initializers/application_controller_renderer.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# ApplicationController.renderer.defaults.merge!(
|
||||
# http_host: 'example.org',
|
||||
# https: false
|
||||
# )
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# bootstrap-markdown plugin relies on rails-assets-bootstrap gem but we use
|
||||
# bootstrap-sass this line makes sure we exclude every asset comming
|
||||
|
|
@ -9,7 +7,12 @@ Rails.configuration.assets.paths.reject! do |path|
|
|||
path.include?("rails-assets-bootstrap") && !path.include?("rails-assets-bootstrap-markdown")
|
||||
end
|
||||
|
||||
Diaspora::Application.configure do
|
||||
config.serve_static_files = AppConfig.environment.assets.serve?
|
||||
# config.static_cache_control = "public, max-age=3600" if AppConfig[:serve_static_assets].to_s == 'true'
|
||||
end
|
||||
# Version of your assets, change this if you want to expire all your assets.
|
||||
Rails.application.config.assets.version = "1.0"
|
||||
|
||||
# Add additional assets to the asset load path.
|
||||
# Rails.application.config.assets.paths << Emoji.images_path
|
||||
# Add Yarn node_modules folder to the asset load path.
|
||||
# Rails.application.config.assets.paths << Rails.root.join("node_modules")
|
||||
|
||||
Rails.application.config.public_file_server.enabled = AppConfig.environment.assets.serve?
|
||||
|
|
|
|||
7
config/initializers/backtrace_silencers.rb
Normal file
7
config/initializers/backtrace_silencers.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||
|
||||
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
||||
# Rails.backtrace_cleaner.remove_silencers!
|
||||
5
config/initializers/cookies_serializer.rb
Normal file
5
config/initializers/cookies_serializer.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Specify a serializer for the signed and encrypted cookie jars.
|
||||
# Valid options are :json, :marshal, and :hybrid.
|
||||
Rails.application.config.action_dispatch.cookies_serializer = :marshal
|
||||
|
|
@ -1,4 +1,11 @@
|
|||
Rails.application.config.middleware.insert 0, Rack::Cors do
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Avoid CORS issues when API is called from the frontend app.
|
||||
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
|
||||
|
||||
# Read more: https://github.com/cyu/rack-cors
|
||||
|
||||
Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
||||
allow do
|
||||
origins "*"
|
||||
resource "/api/openid_connect/user_info", methods: %i(get post)
|
||||
|
|
@ -6,6 +13,5 @@ Rails.application.config.middleware.insert 0, Rack::Cors do
|
|||
resource "/.well-known/host-meta"
|
||||
resource "/.well-known/webfinger"
|
||||
resource "/.well-known/openid-configuration"
|
||||
resource "/webfinger"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# 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 += %i(password message text bio)
|
||||
Rails.application.config.filter_parameters += %i[password message text bio]
|
||||
|
|
|
|||
16
config/initializers/inflections.rb
Normal file
16
config/initializers/inflections.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new inflection rules using the following format. Inflections
|
||||
# are locale specific, and you may define rules for as many different
|
||||
# locales as you wish. All of these examples are active by default:
|
||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||
# inflect.plural /^(ox)$/i, '\1en'
|
||||
# inflect.singular /^(ox)en/i, '\1'
|
||||
# inflect.irregular 'person', 'people'
|
||||
# inflect.uncountable %w( fish sheep )
|
||||
# end
|
||||
|
||||
# These inflection rules are supported but not enabled by default:
|
||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||
# inflect.acronym 'RESTful'
|
||||
# end
|
||||
4
config/initializers/mime_types.rb
Normal file
4
config/initializers/mime_types.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
# Mime::Type.register "text/richtext", :rtf
|
||||
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
||||
wrap_parameters format: [:json]
|
||||
end
|
||||
|
||||
# To enable root element in JSON for ActiveRecord objects.
|
||||
ActiveSupport.on_load(:active_record) do
|
||||
self.include_root_in_json = true
|
||||
self.include_root_in_json = true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ require "sidekiq/web"
|
|||
require "sidekiq/cron/web"
|
||||
Sidekiq::Web.set :sessions, false # disable rack session cookie
|
||||
|
||||
Diaspora::Application.routes.draw do
|
||||
Rails.application.routes.draw do
|
||||
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
||||
|
||||
resources :report, except: %i(edit new show)
|
||||
|
||||
|
|
|
|||
6
config/spring.rb
Normal file
6
config/spring.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
%w[
|
||||
.ruby-version
|
||||
.rbenv-vars
|
||||
tmp/restart.txt
|
||||
tmp/caching-dev.txt
|
||||
].each {|path| Spring.watch(path) }
|
||||
Loading…
Reference in a new issue