update config directory for rails 5
This commit is contained in:
parent
2e49701dea
commit
2ffd62674d
18 changed files with 139 additions and 92 deletions
|
@ -1,4 +1,4 @@
|
|||
require File.expand_path('../boot', __FILE__)
|
||||
require_relative 'boot'
|
||||
|
||||
require 'csv'
|
||||
require 'rails/all'
|
||||
|
@ -15,21 +15,6 @@ module Metamaps
|
|||
# Custom directories with classes and modules you want to be autoloadable.
|
||||
config.autoload_paths << Rails.root.join('app', 'services')
|
||||
|
||||
# Only load the plugins named here, in the order given (default is alphabetical).
|
||||
# :all can be used as a placeholder for all plugins not explicitly named.
|
||||
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
||||
|
||||
# Activate observers that should always be running.
|
||||
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
||||
|
||||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||
# config.time_zone = 'Central Time (US & Canada)'
|
||||
|
||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||
# config.i18n.default_locale = :de
|
||||
|
||||
# Configure the default encoding used in templates for Ruby 1.9.
|
||||
config.encoding = "utf-8"
|
||||
|
||||
|
@ -43,17 +28,9 @@ module Metamaps
|
|||
# Configure sensitive parameters which will be filtered from the log file.
|
||||
config.filter_parameters += [:password]
|
||||
|
||||
# Use SQL instead of Active Record's schema dumper when creating the database.
|
||||
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
||||
# like if you have constraints or database-specific column types
|
||||
# config.active_record.schema_format = :sql
|
||||
|
||||
# Enable the asset pipeline
|
||||
config.assets.initialize_on_precompile = false
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets
|
||||
config.assets.version = '2.0'
|
||||
|
||||
config.generators do |g|
|
||||
g.test_framework :rspec
|
||||
end
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
require 'rubygems'
|
||||
require 'rails/commands/server'
|
||||
|
||||
module Rails
|
||||
class Server
|
||||
def default_options
|
||||
|
@ -9,6 +10,6 @@ module Rails
|
|||
end
|
||||
|
||||
# Set up gems listed in the Gemfile.
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
||||
|
||||
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
||||
require 'bundler/setup'
|
||||
|
|
9
config/cable.yml
Normal file
9
config/cable.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
development:
|
||||
adapter: async
|
||||
|
||||
test:
|
||||
adapter: async
|
||||
|
||||
production:
|
||||
adapter: redis
|
||||
url: redis://localhost:6379/1
|
|
@ -1,5 +1,5 @@
|
|||
# Load the rails application
|
||||
require File.expand_path('../application', __FILE__)
|
||||
# Load the Rails application.
|
||||
require_relative 'application'
|
||||
|
||||
# Initialize the rails application
|
||||
Metamaps::Application.initialize!
|
||||
# Initialize the Rails application.
|
||||
Rails.application.initialize!
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
Metamaps::Application.configure do
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
config.log_level = :warn
|
||||
config.eager_load = true
|
||||
config.assets.js_compressor = :uglifier
|
||||
|
||||
# Code is not reloaded between requests
|
||||
config.cache_classes = true
|
||||
|
@ -13,13 +12,12 @@ Metamaps::Application.configure do
|
|||
config.action_controller.perform_caching = true
|
||||
|
||||
# Disable Rails's static asset server (Apache or nginx will already do this)
|
||||
config.serve_static_files = true
|
||||
config.public_file_server.enabled = false
|
||||
|
||||
# Don't fallback to assets pipeline if a precompiled asset is missed
|
||||
config.assets.compile = false
|
||||
|
||||
# Compress JavaScripts and CSS
|
||||
config.assets.compress = true
|
||||
|
||||
config.assets.js_compressor = :uglifier
|
||||
|
||||
# S3 file storage
|
||||
config.paperclip_defaults = {
|
||||
|
@ -38,7 +36,6 @@ Metamaps::Application.configure do
|
|||
port: ENV['SMTP_PORT'],
|
||||
user_name: ENV['SMTP_USERNAME'],
|
||||
password: ENV['SMTP_PASSWORD'],
|
||||
#domain: ENV['SMTP_DOMAIN']
|
||||
authentication: 'plain',
|
||||
enable_starttls_auto: true,
|
||||
openssl_verify_mode: 'none' }
|
||||
|
@ -46,54 +43,13 @@ Metamaps::Application.configure do
|
|||
# Don't care if the mailer can't send
|
||||
config.action_mailer.raise_delivery_errors = true
|
||||
|
||||
# Don't fallback to assets pipeline if a precompiled asset is missed
|
||||
config.assets.compile = false
|
||||
|
||||
# Generate digests for assets URLs
|
||||
config.assets.digest = true
|
||||
|
||||
# Defaults to Rails.root.join("public/assets")
|
||||
# config.assets.manifest = YOUR_PATH
|
||||
|
||||
# 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
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
# config.force_ssl = true
|
||||
|
||||
# See everything in the log (default is :info)
|
||||
# config.log_level = :debug
|
||||
|
||||
# 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
|
||||
# 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"
|
||||
|
||||
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
||||
#config.assets.precompile += %w( )
|
||||
|
||||
# Disable delivery errors, bad email addresses will be ignored
|
||||
# config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
# Enable threaded mode
|
||||
# config.threadsafe!
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# the I18n.default_locale when a translation can not be found)
|
||||
config.i18n.fallbacks = true
|
||||
|
||||
# Send deprecation notices to registered listeners
|
||||
config.active_support.deprecation = :notify
|
||||
|
||||
# Log the query plan for queries taking more than this (works
|
||||
# with SQLite, MySQL, and PostgreSQL)
|
||||
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ Metamaps::Application.configure do
|
|||
config.cache_classes = true
|
||||
|
||||
# Configure static asset server for tests with Cache-Control for performance
|
||||
config.serve_static_files = true
|
||||
config.public_file_server.enabled = true
|
||||
config.static_cache_control = "public, max-age=3600"
|
||||
|
||||
# Show full error reports and disable caching
|
||||
|
|
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
|
||||
# )
|
12
config/initializers/assets.rb
Normal file
12
config/initializers/assets.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets.
|
||||
Rails.application.config.assets.version = '2.0'
|
||||
Rails.application.config.assets.quiet = true
|
||||
|
||||
# Add additional assets to the asset load path
|
||||
# Rails.application.config.assets.paths << Emoji.images_path
|
||||
|
||||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||
# Rails.application.config.assets.precompile += %w( search.js )
|
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 = :hybrid
|
4
config/initializers/filter_parameter_logging.rb
Normal file
4
config/initializers/filter_parameter_logging.rb
Normal file
|
@ -0,0 +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 += [:password]
|
|
@ -1,15 +1,16 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new inflection rules using the following format
|
||||
# (all these examples are active by default):
|
||||
# ActiveSupport::Inflector.inflections do |inflect|
|
||||
# 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 do |inflect|
|
||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||
# inflect.acronym 'RESTful'
|
||||
# end
|
||||
|
|
|
@ -2,6 +2,5 @@
|
|||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
# Mime::Type.register "text/richtext", :rtf
|
||||
# Mime::Type.register_alias "text/html", :iphone
|
||||
|
||||
Mime::Type.register "application/xls", :xls
|
||||
|
|
24
config/initializers/new_framework_defaults.rb
Normal file
24
config/initializers/new_framework_defaults.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file contains migration options to ease your Rails 5.0 upgrade.
|
||||
#
|
||||
# Read the Rails 5.0 release notes for more info on each option.
|
||||
|
||||
# Enable per-form CSRF tokens. Previous versions had false.
|
||||
Rails.application.config.action_controller.per_form_csrf_tokens = true
|
||||
|
||||
# Enable origin-checking CSRF mitigation. Previous versions had false.
|
||||
Rails.application.config.action_controller.forgery_protection_origin_check = true
|
||||
|
||||
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
|
||||
# Previous versions had false.
|
||||
ActiveSupport.to_time_preserves_timezone = true
|
||||
|
||||
# Require `belongs_to` associations by default. Previous versions had false.
|
||||
Rails.application.config.active_record.belongs_to_required_by_default = true
|
||||
|
||||
# Do not halt callback chains when a callback returns false. Previous versions had true.
|
||||
ActiveSupport.halt_callback_chains_on_return_false = false
|
||||
|
||||
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
|
||||
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
|
|
@ -4,4 +4,4 @@
|
|||
# If you change this key, all old signed cookies will become invalid!
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
Metamaps::Application.config.secret_key_base = ENV['SECRET_KEY_BASE']
|
||||
Rails.application.config.secret_key_base = ENV['SECRET_KEY_BASE']
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Metamaps::Application.config.session_store :cookie_store, key: '_Metamaps_session'
|
||||
Rails.application.config.session_store :cookie_store, key: '_Metamaps_session'
|
||||
|
||||
# Use the database for sessions instead of the cookie-based default,
|
||||
# which shouldn't be used to store highly confidential information
|
||||
# (create the session table with "rails generate session_migration")
|
||||
# Metamaps::Application.config.session_store :active_record_store
|
||||
# Rails.application.config.session_store :active_record_store
|
||||
|
|
|
@ -8,7 +8,7 @@ ActiveSupport.on_load(:action_controller) do
|
|||
wrap_parameters format: [:json]
|
||||
end
|
||||
|
||||
# Disable root element in JSON by default.
|
||||
ActiveSupport.on_load(:active_record) do
|
||||
self.include_root_in_json = false
|
||||
end
|
||||
# To enable root element in JSON for ActiveRecord objects.
|
||||
# ActiveSupport.on_load(:active_record) do
|
||||
# self.include_root_in_json = true
|
||||
# end
|
||||
|
|
47
config/puma.rb
Normal file
47
config/puma.rb
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Puma can serve each request in a thread from an internal thread pool.
|
||||
# The `threads` method setting takes two numbers a minimum and maximum.
|
||||
# Any libraries that use thread pools should be configured to match
|
||||
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
||||
# and maximum, this matches the default thread size of Active Record.
|
||||
#
|
||||
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
|
||||
threads threads_count, threads_count
|
||||
|
||||
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
|
||||
#
|
||||
port ENV.fetch("PORT") { 3000 }
|
||||
|
||||
# Specifies the `environment` that Puma will run in.
|
||||
#
|
||||
environment ENV.fetch("RAILS_ENV") { "development" }
|
||||
|
||||
# Specifies the number of `workers` to boot in clustered mode.
|
||||
# Workers are forked webserver processes. If using threads and workers together
|
||||
# the concurrency of the application would be max `threads` * `workers`.
|
||||
# Workers do not work on JRuby or Windows (both of which do not support
|
||||
# processes).
|
||||
#
|
||||
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
||||
|
||||
# Use the `preload_app!` method when specifying a `workers` number.
|
||||
# This directive tells Puma to first boot the application and load code
|
||||
# before forking the application. This takes advantage of Copy On Write
|
||||
# process behavior so workers use less memory. If you use this option
|
||||
# you need to make sure to reconnect any threads in the `on_worker_boot`
|
||||
# block.
|
||||
#
|
||||
# preload_app!
|
||||
|
||||
# The code in the `on_worker_boot` will be called if you are using
|
||||
# clustered mode by specifying a number of `workers`. After each worker
|
||||
# process is booted this block will be run, if you are using `preload_app!`
|
||||
# option you will want to use this block to reconnect to any threads
|
||||
# or connections that may have been created at application boot, Ruby
|
||||
# cannot share connections between processes.
|
||||
#
|
||||
# on_worker_boot do
|
||||
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
||||
# end
|
||||
|
||||
# Allow puma to be restarted by `rails restart` command.
|
||||
plugin :tmp_restart
|
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